I am trying to snap the mouse cursor to the center of the window every frame. I tried using the robot class to do this, but the problem with that solution is it positions the cursor relative to the screen, not the window, so it only works in fullscreen.
Is there a better way to move the cursor to the center of the window, or if not, is there a way to get the x and y position of the window on screen?
hello, it sounds a little confusing. if you position the mouse in the center every frame it basically means that the mouse becomes unusable to you, no ? in that case, you could ignore mouseX and mouseY as a means of interaction and use noCursor() to hide it.
if you use the mouse as a navigational tool as is usual in FPS games, you might simply not show the cursor (tickling your avatar in the back) and use mouseX to turn him left and right.
however, for your question, maybe this will be interesting to you: