4
« on: June 17, 2011, 08:22:46 am »
Here is the code from tutorial modified to handle window event resized.
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Events");
// Start main loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.PollEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
// Resize window : set new size
if (Event.Type == sf::Event::Resized)
App.SetSize(Event.Size.Width, Event.Size.Height);
}
// Display window on screen
App.Display();
}
return EXIT_SUCCESS;
}
Closing the window works fine however if I try to resize it keeps jumping between new and old size - looping in event loop. I don't know if it is my fault or a bug, any help appreciated!