Customizing the Mouse Cursor

Problem

You want to use a custom mouse cursor.

Solution

Setting the mouse cursor is done with Input.set_custom_mouse_cursor(). All you need is a texture to use. The texture must be no larger than 256x256 pixels in size.

For example, to use the following image:

alt

And set its hotspot to the center:

extends Node2D

func _ready():
    Input.set_custom_mouse_cursor(cursor_image,
            Input.CURSOR_ARROW,
            Vector2(64, 64))

The second parameter sets which system cursor to replace. See the Input docs for the full list.

Comments

comments powered by Disqus