Add option to lock cursor to window - #423
Conversation
Locking the cursor to the window prevents the mouse from leaving the window. This is useful in windowed mode where accidentally leaving the window results in the game being paused. The F9 key has been globally bound to toggle this option. osu! uses F9 to toggle its extended chat window, but opsu! is unlikely to implement a chat feature. As well, it is close to the F10 key, which toggles mouse buttons.
83110be to
a8f615a
Compare
|
Unfortunately this has been broken in Slick2D since the beginning: #45 (comment) Just tried it again, and this still completely breaks touchscreen support. :/ |
|
That's why I put it behind an option that's turned off by default. @fluddokt's fork would probably want to have this permanently disabled. Is there a way we can put a visible warning or detect that it's a touch screen? Or perhaps as a less-than-optimal workaround, disable it in fullscreen mode? Unfortunately, I don't have a touch screen to test on. How exactly is it broken? Is it that it doesn't register any taps (or taps in the middle of the window) because the mouse position is internally managed by LWJGL? If so, the alternative solution I thought of was to set a mouse listener on mouse move and clamp the cursor position to the bounds of the window. Is there a way to find out what the absolute positions are for the corners of the window? |
|
I realized that a drawing tablet will probably experience the same issue as a touch screen, both being absolute pointing devices. I'll see what I can do with that. |
|
please work on opsu |
Locking the cursor to the window prevents the mouse from leaving the window. This is useful in windowed mode where accidentally leaving the window results in the game being paused.
The
F9key has been globally bound to toggle this option. osu! usesF9to toggle its extended chat window, but opsu! is unlikely to implement a chat feature. As well, it is close to theF10key, which toggles mouse buttons.