Download

Show mouse cursor on mouse input / hide on anything else?

I’m making a top-down point-and-click RPG game, but keyboard WASD / gamepad movement also works.

For that reason, I want the game to display the mouse cursor when it detects any mouse input (not only button clicks, but mouse movement also), and hide the mouse cursor on any other input such as keyboard and gamepad inputs.

This is how I’m trying to handle it:

image

First, if any key is pressed, it checks if it’s one of the mouse inputs from an array, and if it is it shows mouse cursor, as long as it wasn’t already being shown, and if it’s not it hides mouse cursor if it wasn’t hidden already. This part works fine

Then, on mouse X/Y movement, if it moves beyond 0.0 it checks if Show Mouse Cursor is enabled, and if not, enables it. Then after a small delay it’s able to check again, as long as mouse moves beyond 0.0

This last part should work I assume, and right as I open the game it does work, until I click any of the mouse buttons, then mouse axis will stop capturing for whatever reason (as I’m trying to figure out why on this thread Show Mouse Cursor cancels out Mouse Axis values?)

but since this currently doesn’t work, my question is: is there an alternative solution for showing mouse cursor upon mouse input?