rust_minifb
rust_minifb copied to clipboard
Capture cursor
I'd like a way to capture the cursor inside the window (to the center, like some games), is it possible for this feature to be added to minifb?
It's certainly possible, but not something I have planned to do. Would it be possible for you to do a PR with this feature?
Not sure, especially because I have to reboot to access other OSes and I'm currently focused on another project. I suppose I could just use click and drag instead of cursor locking.
So exactly what do you need to support this? a set_cursor_pos
would do the trick?
I suppose it could be hacked together by setting the cursor position every frame, yeah. But, I would prefer to use the OS's cursor locking.
Also, I just ran into a weird bug where there is a blank space at the top of the window.
That has absolutely nothing to do with this, but here it is.
I think many games actually just set the cursor pos actually (that is because in an FPS you want to detect the direction the user switches the mouse and then you move it back to the center after detecting it)
Unsure what the issue above is, likely something with client area of the window being calculated wrong or something like.
I think many games actually just set the cursor pos actually (that is because in an FPS you want to detect the direction the user switches the mouse and then you move it back to the center after detecting it)
Well, it will probably work just fine :P
likely something with client area of the window being calculated wrong
The window's detected correctly, that's why the buffer is the right size, but the positioning of the buffer gets screwed up.
Is setting cursor position still unsupported?
Yes, it's still unsupported.
I wrote a function for windows and made a PR: https://github.com/emoon/rust_minifb/pull/321