-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
Enabled pointer lock to capture the pointer when the canvas is clicked #788
base: main
Are you sure you want to change the base?
Conversation
I think it was because NDS had mouse support. |
It was restricted to nds because that was the only system I was aware of that needs the mouse to be locked. I don't think we should lock for every system. If a system consistently across every game needs to lock, we should lock the cursor for that system, but if only a few games need it, they should enable an option to enable locking. From my point of view this can be confusing to the user and feels unclean to lock your cursor to do nothing with it |
I think there's arguments for both sides. For a system like Gaseous where EJS is used for multiple platforms, it would be more consistent from a UX point of view to have the same behaviour for all - plus it telegraphs to the user that input is going to EJS. Perhaps a compromise of it being enabled by a variable would be a good idea? Doing it this way means that projects can set it how they want. This would also mean that we don't have to account for every use case in code as that could get ugly. We don't want to prevent those 5 users from using a mouse with their SNES ROMs after all :D https://en.wikipedia.org/wiki/Super_NES_Mouse The variable would enable or disable the pointer lock, but would be ignored on touch devices as it currently is. |
I do think that's the best idea, a config option you can enable to lock the pointer (with disabled by default) Maybe this should be put in the settings menu rather than its own global variable option? |
Perhaps both? If defined by the global option, we hide it from the settings menu. Otherwise show it and allow the user to set it. |
That works too, only end difference would be hiding it if it's forced enabled since if it's in the settings menu it can be set via default options |
Something I haven't been able to work out is how to detect if we're on a touch platform when we're building the menu. If we're on a touch platform, I'd like to hide the "Capture Pointer" menu item from Settings as it's not relevant - and wouldn't do anything anyway. |
Can we set any systems that consistently have a need for pointer lock to have this setting enabled by default?
From what Ive seen theres no true way to tell if the user has a mouse plugged in, and they could at any time just plug one in. |
I'm sure we can. Though that might make the UX a bit inconsistent. Lets say I want to play Sonic on Mega Drive, there would be no mouse capture. Then I want to play Super Frog on Amiga, there would be a mouse capture. The behaviour being slightly different during gameplay might be a bit off putting. Perhaps an "Auto" option in addition to Enabled and Disabled? Then the user can select the behaviour they want. The bigger issue is how do we define which systems support it? I'd love to get away from magic values in the code (like the removed "if core is NDS" condition). I really need to come up with a JSON structure in the build project to define core capabilities, file types, etc.
I don't think there would be too much issue with just detecting if we're on a mobile device or not at start up. Granted it's not as clean as "plug mouse into an iPad and now the option appears", but it's not totally ugly either :D |
I guess I could understand that. I thought it felt fine before though, because from my point of view it makes sense to lock based on whether or not the console needs it, and locking for a console that will never use it is confusing, from my point of view. While it may appear inconsistent, it's consistently inconsistent
We could just define an array and check if the core is in that array, and set it to enabled based on that.
I think this would cause confusion in the long run.
Issue with this is we can't check for emulators/chromeos's android subsystem/waydroid |
I have an idea for managing this. I've removed the reviewers for the time being, and will convert this to a draft PR. |
Logic to implement: #816 (comment)
|
The code was already in place, but was restricted to only running on the NDS (for testing I assume?). This PR removes that check to make pointer capture available for all cores.
This functionality is useful for many platforms that use a mouse as a primary input device.