Skip to content

Platform: implement mouse capturing for SDL and GLFW - #419

Draft
mosra wants to merge 1 commit into
masterfrom
mousecapture
Draft

Platform: implement mouse capturing for SDL and GLFW#419
mosra wants to merge 1 commit into
masterfrom
mousecapture

Conversation

@mosra

@mosra mosra commented Jan 30, 2020

Copy link
Copy Markdown
Owner

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

codecov-io commented Jan 30, 2020

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.62%. Comparing base (fa11762) to head (4cf68c2).
⚠️ Report is 4256 commits behind head on master.

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LB--

LB-- commented Feb 6, 2020

Copy link
Copy Markdown
Contributor

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

mosra commented Feb 6, 2020

Copy link
Copy Markdown
Owner Author

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