opsu icon indicating copy to clipboard operation
opsu copied to clipboard

Add option to lock cursor to window

Open tpenguinltg opened this issue 6 years ago • 4 comments

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.

tpenguinltg avatar Aug 19 '18 05:08 tpenguinltg

Unfortunately this has been broken in Slick2D since the beginning: https://github.com/itdelatrisu/opsu/issues/45#issuecomment-78431654

Just tried it again, and this still completely breaks touchscreen support. :/

itdelatrisu avatar Aug 21 '18 05:08 itdelatrisu

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?

tpenguinltg avatar Aug 21 '18 12:08 tpenguinltg

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.

tpenguinltg avatar Oct 08 '18 22:10 tpenguinltg

please work on opsu

kleines-L avatar Jul 23 '21 13:07 kleines-L