-
-
Notifications
You must be signed in to change notification settings - Fork 188
Description
From discord discussion -
Happypig375
Is it possible to hide the OS cursor and draw a custom sprite in place of it?
I suppose the drawing custom sprite part is just static sprite and listening to mouse move events
bryanedds
i'm pretty sure that'd involved the SDL API in some way.
that said, manually drawing a mouse cursor is always going to be more laggy than the OS's hardware cursor.
to implement this without exposing SDL2 details, engine could provide two new properties (both in GameState) -
- HideHardwareCursor - hides the hardware cursor, but only while inside the SDL2 window (otherwise set to showen).
- CenterMouseCursor - when enabled, resets mouse position to center every frame.
to implement this without exposing SDL2
Happypig375
Should be the same performance as the rest of game entities I suppose
The mouse cursor isn't going to be any worse than any other entity in the game
bryanedds
the responsiveness of the mouse cursor is special, which is why it receives hardware acceleration. the approach that's probably considered correct is to change the OS cursor's image rather than hiding it and replacing it with a lagging one.
however, if your game isn't twitch-based, it might not matter.
it will probably affect 'feel' tho
these nuances are why we've not bothered supporting any specific approach, leaving it to the user to drive SDL directly through its API to achieve what they really need.
the proper engine API i think would let the user set the mouse cursor's graphic directly while the mouse is over the window.
this should afford both low latency and user customizability.