summaryrefslogtreecommitdiff
path: root/Game/Selection/selectable_area.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Selection/selectable_area.gd')
-rw-r--r--Game/Selection/selectable_area.gd29
1 files changed, 29 insertions, 0 deletions
diff --git a/Game/Selection/selectable_area.gd b/Game/Selection/selectable_area.gd
new file mode 100644
index 0000000..59d4be7
--- /dev/null
+++ b/Game/Selection/selectable_area.gd
@@ -0,0 +1,29 @@
+extends Area2D
+
+
+signal hover_enter
+signal hover_exit
+signal select(event: InputEvent)
+
+
+func _on_area_entered(_area: Area2D) -> void:
+ hover_enter.emit()
+
+
+func _on_area_exited(_area: Area2D) -> void:
+ hover_exit.emit()
+
+
+func _on_mouse_entered() -> void:
+ if not get_tree().get_first_node_in_group("selection_rectangle").is_active:
+ hover_enter.emit()
+
+
+func _on_mouse_exited() -> void:
+ if not get_tree().get_first_node_in_group("selection_rectangle").is_active:
+ hover_exit.emit()
+
+
+func _on_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
+ if event.is_action_pressed("select"):
+ select.emit(event)