SFML community forums
Help => Window => Topic started by: lakunar on February 26, 2011, 08:59:24 am
-
How do I skip resize events?
If I resize my window per mouse it generates a huge amount of resize events. How can i skip them and just interpret the last one?
-
What's your OS?
-
What's your OS?
windows 7
The amount of events dependent on the time I'm resizeing the window and the difference window size. So if i maximize the window with the button it's just one event.
Using: Sfml 2
-
This is not normal, Windows is supposed to block everything while the window is being resized. A lot of users would love to get the behaviour that you have, by the way :D
-
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
int count = 0;
while (window.IsOpened()){
sf::Event Event;
while (window.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed){
window.Close();
}else if (Event.Type == sf::Event::Resized){
count++;
std::cout << count << std::endl;
}
}
}
return EXIT_SUCCESS;
This code should output 1 on the first resize?
I got more.
Can someone test it?
-
I can confirm this behavior with SFML 1.6 and Windows XP SP3.
As long as the mousebuttom is held down and the resizing is in progress no event gets processed, but as soon as the button is released all the resizing events triggered during resizing come flooded in at once.
I would appreciate it if all the resizing events could be handled as they appear, but I read its a problem with Windows. (However with Qt, from which I was moving because it was much mightier and bigger in size than I wanted, this was possible.)
At least it would be nice if this whole redundant resizing events could be skipped easily.
I found someone asking a similiar question at stackoverflow (http://stackoverflow.com/questions/3922840/sfml-window-resizing-events-blocking-the-main-thread), and there someone else responded that he uses a thread for event polling to obtain real time behavior even while resizing and moving the window.