Hello,
I'm completely new to SFML and have just begun reading the docs and messing around. I've noticed that I can run my event handler loop and check for events, while outside the loop other things are going on.
How does this loop not stop the program from continuing?
For example:
// Event handler
while (window.pollEvent(event))
{
if (event.type == sf::Event::MouseMoved)
{
triangle[2].position = sf::Vector2f(event.mouseMove.x, event.mouseMove.y);
}
}
// Input
if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))
{
player.move(0, -speed);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
{
player.move(-speed, 0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
{
player.move(0, speed);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
{
player.move(speed, 0);
}
I can move my mouse around AND control keyboard inputs at the same exact time. How does it read that outside the event loop?
Thanks!