aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extension/src/MapMesh.cpp2
-rw-r--r--game/common/map/MapFrame.pngbin0 -> 1043 bytes
-rw-r--r--game/common/map/MapFrame.png.import34
-rw-r--r--game/common/map/minimap.pngbin0 -> 69018 bytes
-rw-r--r--game/common/map/minimap.png.import34
-rw-r--r--game/src/GameSession/MapView.tscn2
-rw-r--r--game/src/GameSession/Minimap.gd15
-rw-r--r--game/src/GameSession/RectangularCamera.gd24
8 files changed, 109 insertions, 2 deletions
diff --git a/extension/src/MapMesh.cpp b/extension/src/MapMesh.cpp
index f0fc819..ff69390 100644
--- a/extension/src/MapMesh.cpp
+++ b/extension/src/MapMesh.cpp
@@ -8,7 +8,7 @@ using namespace OpenVic2;
void MapMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_aspect_ratio", "ratio"), &MapMesh::set_aspect_ratio);
ClassDB::bind_method(D_METHOD("get_aspect_ratio"), &MapMesh::get_aspect_ratio);
-
+
ClassDB::bind_method(D_METHOD("set_repeat_proportion", "proportion"), &MapMesh::set_repeat_proportion);
ClassDB::bind_method(D_METHOD("get_repeat_proportion"), &MapMesh::get_repeat_proportion);
diff --git a/game/common/map/MapFrame.png b/game/common/map/MapFrame.png
new file mode 100644
index 0000000..21aa2ce
--- /dev/null
+++ b/game/common/map/MapFrame.png
Binary files differ
diff --git a/game/common/map/MapFrame.png.import b/game/common/map/MapFrame.png.import
new file mode 100644
index 0000000..04756cc
--- /dev/null
+++ b/game/common/map/MapFrame.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://vr1hq2stk8ny"
+path="res://.godot/imported/MapFrame.png-a4cf5a3479e19f337ce338f6f6ee4eb8.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://common/map/MapFrame.png"
+dest_files=["res://.godot/imported/MapFrame.png-a4cf5a3479e19f337ce338f6f6ee4eb8.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/game/common/map/minimap.png b/game/common/map/minimap.png
new file mode 100644
index 0000000..9e5bdb6
--- /dev/null
+++ b/game/common/map/minimap.png
Binary files differ
diff --git a/game/common/map/minimap.png.import b/game/common/map/minimap.png.import
new file mode 100644
index 0000000..c69c844
--- /dev/null
+++ b/game/common/map/minimap.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://c0sm1jfu4kyv3"
+path="res://.godot/imported/minimap.png-6dff941a6fa3e94c55113971bbb32fcf.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://common/map/minimap.png"
+dest_files=["res://.godot/imported/minimap.png-6dff941a6fa3e94c55113971bbb32fcf.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/game/src/GameSession/MapView.tscn b/game/src/GameSession/MapView.tscn
index 4650acb..63d16ef 100644
--- a/game/src/GameSession/MapView.tscn
+++ b/game/src/GameSession/MapView.tscn
@@ -19,7 +19,7 @@ _camera = NodePath("MapCamera")
_map_mesh_instance = NodePath("MapMeshInstance")
[node name="MapCamera" type="Camera3D" parent="."]
-transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 1, 1)
+transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 1, 0)
[node name="MapMeshInstance" type="MeshInstance3D" parent="."]
transform = Transform3D(10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0)
diff --git a/game/src/GameSession/Minimap.gd b/game/src/GameSession/Minimap.gd
new file mode 100644
index 0000000..4bf028b
--- /dev/null
+++ b/game/src/GameSession/Minimap.gd
@@ -0,0 +1,15 @@
+extends Control
+
+
+var MouseInside: bool = false
+
+func _process(delta):
+ if MouseInside:
+ print(get_local_mouse_position())
+
+func _on_mouse_entered():
+ MouseInside = true
+
+
+func _on_mouse_exited():
+ MouseInside = false
diff --git a/game/src/GameSession/RectangularCamera.gd b/game/src/GameSession/RectangularCamera.gd
new file mode 100644
index 0000000..55deb1d
--- /dev/null
+++ b/game/src/GameSession/RectangularCamera.gd
@@ -0,0 +1,24 @@
+extends Control
+
+
+@export var pos_x = 100.0
+@export var pos_y = 100.0
+@export var zoom_x = 10
+@export var zoom_y = 10
+@onready var _frame: TextureRect = $"../TextureRect"
+
+var RectangularCamera = Rect2(pos_x,pos_y,zoom_x,zoom_y)
+
+func _draw() -> void:
+ draw_rect(RectangularCamera,Color.BLACK,false,-1)
+
+func _on_map_view_map_view_camera_change(camera_position):
+
+ zoom_x = camera_position.y*(_frame.size.x/20)*1.77
+ zoom_y = camera_position.y*(_frame.size.y/20)*1.77
+
+ pos_x = camera_position.x*(_frame.size.x/20) + _frame.size.x/2 - zoom_x/2 # + _frame.size.x/2 - zoom_x/2 - Translation from camera_position.x to pos_x (i.e. 0px for center on camera_pos -> 175px for center on rect_camera)
+ pos_y = camera_position.z*(_frame.size.y/10) + _frame.size.y/2 - zoom_y/2 # + _frame.size.y/2 - zoom_y/2 - Translation from camera_position.y to pos_y (i.e. 0px for center on camera_pos -> 87.5px for center on rect_camera)
+
+ RectangularCamera = Rect2(pos_x,pos_y,zoom_x,zoom_y)
+ queue_redraw()