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

Platform: implement mouse capturing for SDL and GLFW #419

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

Conversation

mosra
Copy link
Owner

@mosra mosra commented Jan 30, 2020

Isn't as straightforward as it originally seemed, and I don't want to push something that'd be deprecated right after in favor of a more consistent API.

TODOs:

  • GLFW has this in a branch right now, scheduled for 3.4 -- Captured cursor mode glfw/glfw#58
  • GLFW has it together with normal/hidden/locked (which would mean extending setCursor()) and those options are mutually exclusive, so maybe do it that way in both instead of setMouseCaptured() that's done in case of SDL?
  • while SDL reports move event coordinates outside of the window, GLFW docs in the branch seem to indicate that the mouse position won't change -- would this mean the mouse move events won't get reported? Would need to test that branch to see.

TODO: GLFW has it together with normal/hidden/locked in setCursor() and
  those options are mutually exclusive, so maybe do it that way instead
  of setMouseCaptured() like in case of SDL?
TODO: while SDL reports move event coordinates outside of the window,
  GLFW docs in the branch seem to indicate that the mouse position won't
  change -- would this mean the mouse move events won't get reported?
@codecov-io
Copy link

Codecov Report

Merging #419 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #419   +/-   ##
=======================================
  Coverage   72.62%   72.62%           
=======================================
  Files         364      364           
  Lines       18971    18971           
=======================================
  Hits        13778    13778           
  Misses       5193     5193

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa11762...4cf68c2. Read the comment docs.

@LB--
Copy link
Contributor

LB-- commented Feb 6, 2020

GLFW docs in the branch seem to indicate that the mouse position won't change -- would this mean the mouse move events won't get reported? Would need to test that branch to see.

My understanding is that GLFW already has "disabled" mode where the mouse is locked to the center of the screen and hidden, intended for first person games where you move the mouse to look around and the speed of camera movement should not be limited at all by the window/screen size, whereas the PR you linked to leaves the mouse cursor visible and free to move anywhere, but prevents it from escaping the client area. So, maybe you were looking at the wrong docs or they were copypasted and not edited properly from the "disabled" docs. At a quick glance, I don't see any commits related to that PR in that branch that affect documentation at all.

@mosra
Copy link
Owner Author

mosra commented Feb 6, 2020

I know about the disabled/hidden mode and there it's a bit different than this ... from the discussion / branch docs I got the impression that the mouse coordinates would get clamped to the window area, i.e. not changing in any way when outside of the window: glfw/glfw@99b55dd

I guess I'll just wait until this materializes.

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

Successfully merging this pull request may close these issues.

3 participants