SFML community forums

Help => Window => Topic started by: Cyrana on December 19, 2016, 11:22:03 am

Title: Window Resizing
Post by: Cyrana on December 19, 2016, 11:22:03 am
Hello dear forum : )

I just found out, that the window does not update during resize.
So I did some research and this seems to be because SFML goes into an infinite loop.
Hence there is no solution to this.

But is there really nothing to do? I heard using another thread would be a solution, but that sounds like an extreme solution.

How much change would SFML need to go through to make this behaviour work as expected (screen shows what actually should be shown when resizing)?
Is switching the event-polling to maybe an observer-pattern a solution?
Anything that could be done? Even if it ends up in editing SFML.

I really would not want to switch my libraries just because of this, as I pretty much love SFML! : )

Thanks for taking your time reading my thread, have a great week!
Title: Re: Window Resizing
Post by: Laurent on December 19, 2016, 11:32:29 am
Yes, the only solution would be to radically change the way SFML is designed, and use callbacks for events (and add one for "repaint") instead of a polling loop. So we'll obviously not go this way ;)

The thread workaround is not as extreme as it looks. You just have to move your event loop to another thread.
Title: Re: Window Resizing
Post by: Cyrana on December 19, 2016, 11:48:33 am
Ah! I can totally understand that : )

Hm, well having it on another thread would require it to be on the same as the window, right?
Title: Re: Window Resizing
Post by: Laurent on December 19, 2016, 12:44:19 pm
Everything you need to know is described here:
http://www.sfml-dev.org/tutorials/2.4/window-window.php#things-to-know-about-windows