You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I call Input.mouse().setGrabMouse(true), the mouse moves in the wrong direction.
I want the player to be able to turn grab mouse on and off, so they can get out of the window without completely closing the game. When I turn grab mouse off, I figure out where the game mouse is and I use a robot to move the actual mouse to that location after calling setGrabMouse(false). This works fine. But when I turn grab mouse on, I'd expect the game mouse to stay where it is (or at the very least, return to the center of the screen). But, instead, it seems to be moving the distance between it and the center of the window, but in the wrong direction.
I believe this is happening in Mouse.setLocation(MouseEvent):
This is, of course, the correct behavior when grab mouse is on. But I think it's incorrect when grab mouse was off during the last update, but is now on. Again, in that case, I think I'd expect the game mouse's position to just stay where it is (even if the mouse is moving back to the center of the screen).
Here's a GIF where I try to demo it, but it's a little hard to show. Details on how to reproduce are below.
To Reproduce
Steps to reproduce the behavior:
Throw this code in your main() or somewhere:
VirtualMouse.instance().getLocationOnScreen() does the following:
Utils.robot is just a normal Robot object.
Run the game and press Alt to release the mouse.
Click somewhere on the screen. Closer to the middle is easier to see what's happening. The game mouse will jump away from the center of the screen.
Your System:
OS: [e.g. iOS]
LITIENGINE version: 0.6.1
Java JDK/JRE version: jdk-21.0.1
Screen resolution: 4K
Btw, I welcome feedback on this code. I haven't worked with the mouse and robots much.
The text was updated successfully, but these errors were encountered:
Describe the bug
When I call Input.mouse().setGrabMouse(true), the mouse moves in the wrong direction.
I want the player to be able to turn grab mouse on and off, so they can get out of the window without completely closing the game. When I turn grab mouse off, I figure out where the game mouse is and I use a robot to move the actual mouse to that location after calling setGrabMouse(false). This works fine. But when I turn grab mouse on, I'd expect the game mouse to stay where it is (or at the very least, return to the center of the screen). But, instead, it seems to be moving the distance between it and the center of the window, but in the wrong direction.
I believe this is happening in Mouse.setLocation(MouseEvent):
This is, of course, the correct behavior when grab mouse is on. But I think it's incorrect when grab mouse was off during the last update, but is now on. Again, in that case, I think I'd expect the game mouse's position to just stay where it is (even if the mouse is moving back to the center of the screen).
Here's a GIF where I try to demo it, but it's a little hard to show. Details on how to reproduce are below.
To Reproduce
Steps to reproduce the behavior:
Throw this code in your main() or somewhere:
VirtualMouse.instance().getLocationOnScreen() does the following:
Utils.robot is just a normal Robot object.
Run the game and press Alt to release the mouse.
Click somewhere on the screen. Closer to the middle is easier to see what's happening. The game mouse will jump away from the center of the screen.
Your System:
Btw, I welcome feedback on this code. I haven't worked with the mouse and robots much.
The text was updated successfully, but these errors were encountered: