23 lines
612 B
GDScript
23 lines
612 B
GDScript
extends Node
|
|
|
|
# Preload all your cursor images
|
|
const CURSORS = {
|
|
"default": preload("res://cursors/default.png"),
|
|
"interact": preload("res://cursors/hand.png"),
|
|
"move": preload("res://cursors/walk.png"),
|
|
"look": preload("res://cursors/eye.png"),
|
|
"test": preload("res://cursors/test.png"),
|
|
}
|
|
|
|
var _current: String = "default"
|
|
|
|
func set_cursor(hint: String) -> void:
|
|
if hint == _current:
|
|
return
|
|
var texture = CURSORS.get(hint, CURSORS["default"])
|
|
Input.set_custom_mouse_cursor(texture, Input.CURSOR_ARROW, Vector2(32, 32))
|
|
_current = hint
|
|
|
|
func reset() -> void:
|
|
set_cursor("default")
|