summaryrefslogtreecommitdiff
path: root/ui/window.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-12-24 00:36:06 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-12-24 00:36:06 +0100
commit6e2deea3d1b2fb4d79dac02a0d4310936c7f317c (patch)
tree05590a7d9f7cecde037aad7a5487ff2c62176932 /ui/window.gd
parent7b3f386449aeab124d84d2aff4c273e646e68763 (diff)
next commit
Diffstat (limited to 'ui/window.gd')
-rw-r--r--ui/window.gd19
1 files changed, 19 insertions, 0 deletions
diff --git a/ui/window.gd b/ui/window.gd
new file mode 100644
index 0000000..cd6fade
--- /dev/null
+++ b/ui/window.gd
@@ -0,0 +1,19 @@
+extends PanelContainer
+
+
+var is_dragging := false
+var drag_anchor := Vector2.ZERO
+
+
+func _process(_delta: float) -> void:
+ if is_dragging:
+ global_position += get_global_mouse_position() - drag_anchor
+ drag_anchor = get_global_mouse_position()
+
+
+func _on_title_bar_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("primary_click"):
+ is_dragging = true
+ drag_anchor = get_global_mouse_position()
+ elif event.is_action_released("primary_click"):
+ is_dragging = false