1

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.

Community
  • 1
  • 1
Dan
  • 1,198
  • 4
  • 17
  • 34

1 Answers1

1

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.

Romejanic
  • 419
  • 1
  • 4
  • 9
  • The Cursor is created from an IntBuffer, so to scale it would require redrawing the underlying image, converting it to an IntBuffer, and recreating the Cursor. I could perhaps do this if the scale is only going to change infrequently, but otherwise, it sounds like the only solution is to use a software cursor (drawing the cursor as you described). Thanks for confirming. – Dan Jul 22 '15 at 09:46