SFML community forums

Help => Graphics => Topic started by: Kanefa on August 09, 2014, 12:37:41 pm

Title: Windowed to Fullscreen (change resolution)
Post by: Kanefa on August 09, 2014, 12:37:41 pm
I've been working on letting the user switch between windowed and fullscreen.  When I switch from 800x600 windowed mode to fullscreen I want to use the desktop's resolution.  I can fetch the desktop's resolution using VideoMode::GetDesktopMode() function.  However, I am not sure how to apply the new resolution.



Title: Re: Windowed to Fullscreen (change resolution)
Post by: Hiura on August 09, 2014, 01:15:15 pm
You have to recreate the window with the appropriate flags. Use sf::Window::create (http://sfml-dev.org/documentation/2.1/classsf_1_1Window.php#a30e6edf2162f8dbff61023b9de5d961d) for that.
Title: Re: Windowed to Fullscreen (change resolution)
Post by: Kanefa on August 09, 2014, 05:56:58 pm
Thanks for the response.  I have a follow-up question.  In what circumstance would I want the resolution to be different than the size of the view?  Or is this achieving the same effect as calling zoom on the view?

mWindow.create(sf::VideoMode(800, 600), "MyApp", sf::Style::Fullscreen);
sf::View(sf::FloatRect(0, 0, 400, 300));
 
Title: Re: Windowed to Fullscreen (change resolution)
Post by: G. on August 09, 2014, 10:57:16 pm
Yes, it's the same effect.