-
Notifications
You must be signed in to change notification settings - Fork 77
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
Allow setting the mouse cursor position #584
Comments
Setting the cursor position isn't possible on the web. https://stackoverflow.com/questions/4752501/move-the-mouse-pointer-to-a-specific-position |
Seconding @lenscas, unfortunately moving the mouse cursor isn't supported on web. I'm hesitant to add a method only supported on desktop. |
if it gets added, please only expose it for native builds, and/or add it behind a module that makes it painfully clear that it is native only. In my opinion, the fewer run time differences between native and WASM the better. |
Following @lenscas' link, this answer seems to provide a way to do it: https://stackoverflow.com/a/19870963/551779 - it seems that one could lock the mouse and let the app control an internal cursor using mouse position deltas, in which case it's up to the framework to decide where the (internal) pointer is. It would probably mean changing the current web implementation of the mouse handling though. (Also, I should have probably shared my use-case: I'd like to keep the mouse within the bounds of the window when not playing in fullscreen mode.) |
As an user: please don't. If I am not playing in full screen mode, it probably is because I want to quickly use other things as well/have the game behave like normal programs for other reasons. Personally, I dislike the workaround as I think it would degrade the user experience that quicksilver games will have if it got implemented
If you however think that this feature is really needed for your game, you should actually already be able to implement the workaround without having to change anything in quicksilver. Though, libraries that get the mouse cursor location themselves may not work correctly. |
@lenscas, I'm a little lost.
What is this referring to? @sitaktif Just a heads up, all of the input / windowing / cursor handling is upstream in winit. Setting a cursor position isn't possible on web, but you could implement cursor grab (see the docs for an overview on the platform-specific quirks.) If cursor grab worked in a consistent way between desktop and web, I would be open to supporting in Quicksilver. |
that is what the result would be if quicksilver would implement the workaround given in the stackoverflow answers (unless I am missing something). The workaround is to hide the cursor and replace it with an image that is at the location you want the cursor to be. |
I would probably not emulate the cursor states, but only allow cursor grab when the cursor is set to not draw. Then the application can draw its custom cursor or not draw one. |
@lenscas I hear you but for some games, allowing the cursor to leave the window may provide a bad experience (just one example: if the main "character" follows the cursor constantly as a fundamental mechanic). These users may want to play in windowed mode and still have a good game experience, at the expense of needing to press @ryanisaacg thanks for the pointers! I'll have a look at winit and see how audacious that would be given my very basic skillset. |
It would be great to be able to move the mouse cursor position to a specific location.
I imagine doing it with something like
window.mouse().set_position(pos: Vector)
.The text was updated successfully, but these errors were encountered: