SFML community forums

Help => Window => Topic started by: gasim on December 11, 2013, 12:19:59 am

Title: Resize event on window creation
Post by: gasim on December 11, 2013, 12:19:59 am
How can I send a resize event right before the main loop or during creation? It doesn't poll the event:
case sf::Event::Resized:
   std::cout << "resized";
   break;
 

I tried

mRenderWindow.setSize(mRenderWindow.getSize())

No luck. If I resize from use point of view, it resizes (as it should!). After doing some tests and digging through source for validation I found out that, the reason it doesn't resize it because the size doesn't change. Additionally I cannot create a (0,0) render window and then use setSize, since it gives me "invalid drawable" which makes sense.

How can I achieve what I want?
Title: Re: Resize event on window creation
Post by: zsbzsb on December 11, 2013, 12:52:36 am
resizedHandler(xxx); // Pass whatever resized event you want

{ // game loop
   { // event loop
      case sf::Event::Resized: resizedHandler(event); break;
   }
}

void resizedHandler(sf::Event& event)
{
   // Handle resize
}