summaryrefslogtreecommitdiff
path: root/scripts/app.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/app.gd')
-rw-r--r--scripts/app.gd24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/app.gd b/scripts/app.gd
new file mode 100644
index 0000000..18ad260
--- /dev/null
+++ b/scripts/app.gd
@@ -0,0 +1,24 @@
+extends Area2D
+
+signal open_app(app_name: String)
+
+enum Apps { NOTEPAD, FOLDER }
+
+@export var app_name: Apps
+
+var _mouse_in = false
+
+func _ready() -> void:
+ mouse_entered.connect(_on_mouse_entered)
+ mouse_exited.connect(_on_mouse_exited)
+
+func _process(_delta: float) -> void:
+ if Input.is_action_just_pressed("mouse1") and _mouse_in:
+ open_app.emit(app_name)
+
+func _on_mouse_entered():
+ _mouse_in = true
+
+func _on_mouse_exited():
+ _mouse_in = false
+