-
Notifications
You must be signed in to change notification settings - Fork 174
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 support for cursor capture and relative mouse motion #555
base: master
Are you sure you want to change the base?
Conversation
@jlnr What are your thoughts on this PR?
|
@cyberarm Mixed:
I guess the dividing line is that I'd merge anything that helps building great 2D games for desktop and mobile, but I need some convincing with almost-finished projects for anything that goes into the UI toolkit area. |
Having minimize, maximize and restore functions would be useful for windowed borderless applications and games that want a fully custom appearance, e.g. the TimeCrafters Configuration Tool that I wrote for the robotics team would benefit from both the hit-testing and min/maximize functions. |
Aah, I see! Makes sense that borderless windows would need a way to recreate the window decorations. I have to say I prefer how some portable apps (Spotify comes to mind) have native macOS window controls in a non-native window. I've never looked into how it works, but that seems much nicer than manually recreating controls that don't respect the rest of the OS (left vs right window edge, some distros don't have a minimize button, etc.) (It doesn't seem to be trivial because Spotify doesn't do the same thing on Linux :/ It'd probably have to be in SDL2 proper for me to consider it) Anyway, that's pretty deep in UI toolkit land for me. I'd prefer to only merge the cursor capture for now. |
629bbf4
to
065b217
Compare
@jlnr I've removed the window controls and hit testing from this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can you please rebase on master?
- Hmm, isn't this PR missing something to work for something like a 3D shooter? Because if you were to implement mouse camera movements, you wouldn't just want the cursor to be confined to the window, because then once you hit any edge, you cannot move any further. Probably not an issue in other frameworks that have a mouseMove(dx, dy) event, but Gosu doesn't. :/ Or is the intention that users of capture_mouse still need to move the mouse back to the window center every tick?
This was the original intention, however we could use SDL_SetRelativeMouseMode and add
|
e3d193b
to
8a07cdd
Compare
Useful for windowed mouse look games like jcaster, i-mic-fps, etc.