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

Author Topic: Resize event on window creation  (Read 1847 times)

0 Members and 1 Guest are viewing this topic.

gasim

  • Newbie
  • *
  • Posts: 4
    • View Profile
Resize event on window creation
« 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?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Resize event on window creation
« Reply #1 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
}
« Last Edit: December 11, 2013, 12:56:33 am by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

 

anything