
Prevent resize + Mouse-Leave event
Posted Monday, 10 March, 2008 - 18:59 by teichgraf inHello
Is it possible to prevent the resize of the GameWindow?
Something like gameWindow.IsResizable = false.
Does an event exists, witch is fired when the user leaves the GameWindow? Or does a mouse-move event exists?
I am asking, because I have the following case at the moment: When the user leaves the GameWindow and pressed the mouse button, no event like MouseButtonUp or LeaveWindow is fired. Outside the windowe he releases the button and after that re-enters the window -> the state of the mouse button is pressed.
Thanks in advance!


Comments
Re: Prevent resize + Mouse-Leave event
There's no way currently to prevent the window from resizing, but this feature is planned (along with mouse "grabbing").
From OpenTK 0.9.1 onwards, mouse (and keyboard) buttons will be automatically cleared when the window loses focus, to avoid issues with stuck keys.
I am currently testing the performance impact of mouse movement events - if it turns out to be reasonable, they will be enabled by default. Otherwise, you may have to maunally turn them on (something like
Mouse.GenerateMoveEvents = true). This feature is unlikely to make it in 0.9.1, though.Re: Prevent resize + Mouse-Leave event
Thanks for the fast answer.
What I am doing now:
So, when you say...
From OpenTK 0.9.1 onwards, mouse (and keyboard) buttons will be automatically cleared when the window loses focus, to avoid issues with stuck keys.
... how will this be done in 0.9.1? Or does the Mouse instance will have a
Mouse.Buttonsproperty?Re: Prevent resize + Mouse-Leave event
... how will this be done in 0.9.1? Or does the Mouse instance will have a Mouse.Buttons property?
Actually it does. Hm, maybe this isn't discoverable enough, but you can just do:
Re: Prevent resize + Mouse-Leave event
Sorry,
...
It is consequent to handle this like the Keyboard.
Thanks!
Re: Prevent resize + Mouse-Leave event
No problem. :)
Do you think a function like
Mouse.IsButtonPressed(MouseButton b)would be more intuitive? The other solution is to have Left, Right, Middle, etc boolean properties - but this is going to be tedious to implement for Keyboard (too many keys!)Re: Prevent resize + Mouse-Leave event
I think it would be nice to have both
Mouse.IsButtonPressed(MouseButton b)andMouse[b]. The Intellisense would supportMouse.->Mouse.IsButtonPressed(MouseButton b).Re: Prevent resize + Mouse-Leave event
What about this:
.. or maybe ..
It seems more consistent than having special methods for button-properties but not coordinate-properties of the mouse.
Re: Prevent resize + Mouse-Leave event
Any other people wishing to share their preference?
I won't cast my vote yet, to avoid affecting the results. :)