blob: 851441db1c947b68520ba45ef26517c528d3507f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
|