Mouse cursor

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DimitriyPS

I want to use my drawn mouse cursor. But not pre-drawn, but drawn with GDScript. I know how to draw. My question is how to use it?

P.S.: I had an implementation for Godot 2.1. It works in 3.0 but causes braking (which is very strange).

:bust_in_silhouette: Reply From: rolfpancake

My best bet would be:

Draw your mouse cursor in a Node2D, move it to your mouse position and hide the real mouse cursor.

Yes, that’s how I did in Godot 2.1.X. but in 3.0 I faced the fact that it negatively affects the “response” of the interface. For example, pressing the button is processed with 10-20 attempts!

How do you position the cursor? In what method?

DimitriyPS | 2018-02-06 12:53

> For example, pressing the button is processed with 10-20 attempts!
Could you please share a sample project where you get this behaviour?

> How do you position the cursor? In what method?
The _input(event)-method of the root node should be fine. Asking for the InputEventMouseMotion and then set the Node2Ds position with Viewport.get_mouse_position() (see here).

rolfpancake | 2018-02-06 13:17

I found the cause. No, it works right.

I inherited the “Control” node. After exporting to Godot 3.0, you had to set the parameter: “mouse.filter=Ignore”. This was not a brakingon the interface. The reason is that my cursor overlapped the control below.

DimitriyPS | 2018-02-07 12:29

have you had problem with the cursors movement? because I want to do the same thing but when I go into fullscreen the game updates only 60 per second and the mouse cursor lags behind

k4sma | 2018-04-28 22:17

Yes, there is a slight backlog of the sprite from the operating system cursor. But since the operating system cursor is hidden - it’s not visible. This does not have a significant effect on the use of interfaces in game.

DimitriyPS | 2018-05-03 08:22