SFML community forums
General => General discussions => Topic started by: Xorlium on May 07, 2010, 03:31:02 am
-
Hi,
I'm new to SFML, but I'm liking it so far. Just one quick (perhaps newbie) question:
How can I change video mode while the app is running?
I want that if the user presses F o something, it toggles full screen. I've looked through all the possibilities of
a sf::RenderWindow, but I can't find one that says SetVideoMode.
When you create the sf::RenderWindow you need to set video mode, but then how to change it after, I can't figure it out.
Thanks!
-
You just simply recreate the renderwindow with the correct settings :)
-
Hmm... How do I do that then?
This is what I have:
sf::RenderWindow App(sf::VideoMode::GetMode(0), "App");
while (App.IsOpened())
{
/* STUFF HAPPENS */
}
And in there I have something catching events, like on the tutorial. Then when button F is released, I want it to toggle full screen. How can I create a new window, if I'm inside the main loop?
-
Hmm... How do I do that then?
This is what I have:
sf::RenderWindow App(sf::VideoMode::GetMode(0), "App");
while (App.IsOpened())
{
/* STUFF HAPPENS */
}
And in there I have something catching events, like on the tutorial. Then when button F is released, I want it to toggle full screen. How can I create a new window, if I'm inside the main loop?
Inside the while loop when you get a f pressed event run App.Close then App.Create
-
Thanks!!
That works perfectly, thanks! And it's even fast an unnoticeable.