summaryrefslogtreecommitdiff
path: root/cursor.gd
diff options
context:
space:
mode:
Diffstat (limited to 'cursor.gd')
-rw-r--r--cursor.gd37
1 files changed, 37 insertions, 0 deletions
diff --git a/cursor.gd b/cursor.gd
new file mode 100644
index 0000000..851441d
--- /dev/null
+++ b/cursor.gd
@@ -0,0 +1,37 @@
+extends Node
+
+
+@export var arrow_images: Array[Texture2D]
+@export_range(1.0, 10.0, 0.1) var arrow_speed := 7.0
+var arrow_idx := 0.0
+
+@export var click_images: Array[Texture2D]
+@export_range(1.0, 10.0, 0.1) var click_speed := 4.0
+var click_idx := 0.0
+
+class CurrentCursor:
+ var images: Array[Texture2D]
+ var speed: float
+ var idx: float
+
+
+func _process(delta: float) -> void:
+ if Input.get_current_cursor_shape() == Input.CURSOR_ARROW:
+ arrow_idx += (delta * arrow_speed)
+ if arrow_idx > arrow_images.size():
+ arrow_idx = 0
+
+ Input.set_custom_mouse_cursor(arrow_images[floor(arrow_idx)], Input.CURSOR_ARROW)
+ elif Input.get_current_cursor_shape() == Input.CURSOR_POINTING_HAND:
+ click_idx += (delta * click_speed)
+ if click_idx > click_images.size():
+ click_idx = 0
+
+ Input.set_custom_mouse_cursor(click_images[floor(click_idx)], Input.CURSOR_POINTING_HAND)
+ else:
+ Input.set_custom_mouse_cursor(null, Input.get_current_cursor_shape())
+
+
+func _input(event: InputEvent) -> void:
+ if event is InputEventMouseButton:
+ pass