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

Author Topic: Skip resize event  (Read 3407 times)

0 Members and 1 Guest are viewing this topic.

lakunar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Skip resize event
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Skip resize event
« Reply #1 on: February 26, 2011, 01:51:57 pm »
What's your OS?
Laurent Gomila - SFML developer

lakunar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Skip resize event
« Reply #2 on: February 26, 2011, 02:35:50 pm »
Quote from: "Laurent"
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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Skip resize event
« Reply #3 on: February 26, 2011, 03:34:48 pm »
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
Laurent Gomila - SFML developer

lakunar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Skip resize event
« Reply #4 on: February 26, 2011, 03:51:06 pm »
Code: [Select]
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?

NoX

  • Newbie
  • *
  • Posts: 1
    • View Profile
Skip resize event
« Reply #5 on: March 21, 2011, 11:17:00 pm »
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, 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.

 

anything