SFML community forums
Help => Window => Topic started by: arpeggiodragon on August 11, 2010, 06:21:35 am
-
This one is very straightforward. Using this code:
while (window.GetEvent(Event))
{
if( Event.Key.Code == sf::Key::Down )
{
// setting a breakpoint here triggers when the mouse gets moved most the time.
Moving the mouse around will trigger Key::Dir events and possibly (untested) others. Very strange.
Windows XP. VC++ 09. SFML2.0
[edit] - I investigated this further and found this to be re-produceable when moving the the mouse coordinates outside of the top-left corner of the window and back.
In other words: Just shake the mouse real fast next to the window icon. :P
-
What about testing the type of event before assuming it is a KeyPressed? ;)
while (window.GetEvent(Event))
{
if (Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Down)
{
...
}
}
-
Oops! Yep. Works fine. Looks like it's in the documentation also (Which I should probably take a quick look at first when something goes wonky). :)
Thanks.