This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Is there another way to hide the windows cursor other than MOUSEMODEHIDDEN.
I need the functionality of MOUSEMODECONFINED but with the windows cursor hidden as i have my own cursor Sprite following the mouse, so MOUSEMODECAPTURED doesnt work as well.

in Engine by (12 points)

I'm not aware of another way. Though, from the docs, MOUSE_MODE_CAPTURED sounds like what you want. Though, since you mention it doesn't work well, can you explain where it falls short?

MOUSEMODECAPTURED always centers the mouse in the middle of the screen so i cant interact with texturebutton nodes correctly

Hmmm... Yeah, a quick test here shows the same thing (in captured mode, the mouse always reports a single point at the center of the screen).

I'm really not familiar with the details of the MouseMode settings, but MOUSE_MODE_CAPTURED doesn't seem to work as it's documented.

While I'm not sure, that feels like a Godot bug.

is there any "easy" way to view/change the c++ implentation of the gdscript set mouse mode function?

1 Answer

+1 vote

Go to Project Settings - Display - Mouse Cursor - Custom Image
Load the texture there, and you will have the new cursor sprite replacing the original cursor.

EDITED:
Can also use this in code:

Input.set_custom_mouse_cursor(Your Sprite)
by (813 points)
edited by

tried that as well but it seems to ignore opacity/alpha so i cant make it transparent the size restriction also prevents me from replicating the sprite :S

Use this:

Input.set_custom_mouse_cursor(Your Sprite)

You can load your sprite in code where your sprite can be the scene you created. You can change properties like opacity anytime you want.

its the same thing when setting it in project settings, but it doesnt hide the cursor. setting it to an empty sprite or alpha=0 just makes it white/inverse. mby you used linux? iguess its a windows problem if it works for you then

Oh right. That's because it's not a sprite but a resource actually.
You can edit your mouse cursor texture maybe in ps, one for normal, one for transparent. Reset the mouse cursor sprite to what you want it to be as the program goes.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.