Closed PiotrZierhoffer closed 4 years ago
Wouldnt it a better idea to check the window focus state? If not focused, or if in menu, show cursor, else if ingame, and mouse not captured, capture it?
The problem is that your wouldn't be able to change focus - the game recenters your mouse on each loop. You could alt+tab away, but this would not work with focus-on-hover behavior (which I have on my OS).
Good idea about release mouse on unfocus anyways.
I would purely rely on whether the window is focused (not hovered) see above link. Having a key to press is extremely uncommon, and i personaly dislike the need to press a specific key.
Thank you for reporting the issue, and testing on Linux. As I only have Windows machines, it is surprising to me that this port works on Linux without modification.
Regarding the mouse issue, we should consider how other ports handle this issue. I checked GZDoom, PrBoom+ and Crispy Doom, and then found that these ports release mouse when the menu is shown. I like this behavior, as it is more natural, and can be achieved without adding a special key.
I also considered how to handle window focus and some other things, and then made the following rule to determine when to grab/release mouse.
if (window does not have focus)
{
release mouse
}
else if (fullscreen)
{
grab mouse
}
else if (in game && menu is not shown)
{
grab mouse
}
else
{
release mouse
}
I will try this implementation later.
Now the mouse cursor is released by the rule above.
This is a suggestion how to handle #4.
I chose the
o
key for no real reason.I assume regaining the focus could be done a little bit better, as now it implies shooting as well.