Dan
Dan

Reputation: 1248

Transform hardware cursor in LWJGL

I am using LWJGL's Mouse.setNativeCursor() to change the cursor in a game I'm making. However, the rest of the game is scaled up while the cursor retains a 1:1 pixel ratio, so the cursor looks out of place.

Is there an efficient way to transform the cursor on the fly?

If not, is a software cursor (drawing an image at the mouse co-ordinates) generally considered a good alternative? I have been avoiding using one up until now because I have heard that it ties mouse movement to the frame rate of the game which can introduce latency.

Upvotes: 1

Views: 218

Answers (1)

Romejanic
Romejanic

Reputation: 427

I don't know, the only option might be to scale the cursor's texture. Or, you could hide the cursor and draw it in OpenGL. You would just draw a 2D quad above the screen and all of it's contents. This would let you resize it, but it might confuse users and make the mouse more inaccurate.

If you're looking for dynamic scaling without latency, hiding it and drawing the quad might be the best way to go.

Upvotes: 1

Related Questions