Init
This commit is contained in:
22
scripts/cursor_manager.gd
Normal file
22
scripts/cursor_manager.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user