Godot Version
v4.7.dev2.official [778cf54da]
Question
How does one add custom mouse cursor shapes?
The Godot docs say this is how changing the mouse cursor image using code could be done:
extends Node
# Load the custom images for the mouse cursor.
var arrow = load("res://arrow.png")
var beam = load("res://beam.png")
func _ready():
# Changes only the arrow shape of the cursor.
# This is similar to changing it in the project settings.
Input.set_custom_mouse_cursor(arrow)
# Changes a specific shape of the cursor (here, the I-beam shape).
Input.set_custom_mouse_cursor(beam, Input.CURSOR_IBEAM)
I love this, but what if I want to have custom shapes for custom states? Like let’s say, hovering over an enemy spaceship whilst having a weapon selected, and you need to know if the shot will pierce their armour or not, with the cursor image. That sort of thing.
The same Doc page then goes on to say:
There are multiple mouse cursors you can define, documented in the Input.CursorShape enum. Which ones you want to use depends on your use case.
But checking there, I’m not sure how I’d add my own. Any help would be greatly appreciated!