Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - SymmetryBreaking

Pages: [1]
1
Window / Re: Multiple keyreleased events triggering per keyrelease
« on: May 26, 2015, 01:46:19 pm »
Because you don't actually check whether an event has been generated and yet still access the event, which leads to undefined behavior where the event type has a random value which then may match the value of sf::Event::KeyReleased.

Read the official tutorial on how to properly handle events. ;)

D'oh. I knew it was something obvious. I'm a little disappointed it was that obvious, but nonetheless thank you. Works perfectly now.

2
Window / Multiple keyreleased events triggering per keyrelease
« on: May 26, 2015, 01:32:27 pm »
When running the following code in a loop if I simply press and release a key a single one time I find "Key released." printed well over 50 times:

void Game::GameLoop()
{
sf::Event currentEvent;
_mainWindow.pollEvent(currentEvent);

if (currentEvent.type == sf::Event::KeyReleased)
std::cout << "Key released." << std::endl;

}
 

while (!Exit())
{
GameLoop();
}
 

This is using SFML 2.3 with Microsoft Visual Studio Express 2013 with a release build.

Pages: [1]
anything