I thought using waitEvent instead of Poll event in the exact same cycle would make my program block until an event is recived (like a mouse click). Instead whatever i do the program is stuck there and does nothing...
int window_mode()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "GraphMaker");
while (window.isOpen())
{
// Process events
sf::Event event;
//while (window.pollEvent(event))
while (window.waitEvent(event))
{
// Close window: exit
switch (event.type)
{
case sf::Event::Closed:
window.close();
break;
case sf::Event::MouseButtonPressed:
//do stuff
break;
case sf::Event::MouseButtonReleased:
//do stuff
break;
case sf::Event::MouseMoved:
//do stuff
break;
}
}
// CLS
window.clear();
// DRAW
//draw stuff
window.display();
}
return 0;
}
Compiling with visual studio, if that matters.
So i'm wrong thinking it should work this way or there's something else going wrong?