diff options
Diffstat (limited to 'ui/chat_window.gd')
-rw-r--r-- | ui/chat_window.gd | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ui/chat_window.gd b/ui/chat_window.gd index c88a3ee..7841d57 100644 --- a/ui/chat_window.gd +++ b/ui/chat_window.gd @@ -3,6 +3,9 @@ extends PanelContainer @export var player_color: Color = Color8(255, 255, 255) +var is_dragging := false +var drag_anchor := Vector2.ZERO + func _ready() -> void: # clear test label @@ -57,3 +60,17 @@ func _on_broadcast_formatted_message_packet_received(packet: BroadcastFormattedM format.size = packet.font_size add_message(packet.message, format) + + +func _process(_delta: float) -> void: + if is_dragging: + global_position += get_global_mouse_position() - drag_anchor + drag_anchor = get_global_mouse_position() + + +func _on_handle_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 |