Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to lock cursor to window #423

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tpenguinltg
Copy link
Contributor

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.

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.
@itdelatrisu
Copy link
Owner

Unfortunately this has been broken in Slick2D since the beginning: #45 (comment)

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

@tpenguinltg
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@kleines-L
Copy link

please work on opsu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants