views:

39

answers:

1

I just started using the SFML library and its fantastic. However when resizing a window by dragging the corner with my mouse i don't get the resize events until i release the mouse. This means i can't update my graphics until the mouse is released (game loop is on the gui thread) and is also causing a massive flood of events to come through of all the resize positions.

How can i make it so resizing doesn't block the thread?

A: 

Maybe try filtering the resize events, and using the last one in the queue to update with.

Note that SFML's website tutorial advises using a while loop to read all pending events. Are you doing something like the following?

while (Running)
{
    sf::Event Event;
    while (App.GetEvent(Event))
    {
        // Process event
    }

    App.Display();
}

In addition, the tutorial has this to say about views:

"The default view is not updated when its window is resized : as a consequence, what's visible in your window will never be affected by its size (ie. you won't see more if you maximize the window), which is exactly what happens with a 3D camera. However, you can easily setup a view which always keeps the same dimension as the window, by catching the sf::Event::Resized event and updating the view accordingly." (from http://www.sfml-dev.org/tutorials/1.6/graphics-views.php)

Truncheon