SFML community forums

Help => Window => Topic started by: waxx on June 21, 2012, 04:38:13 pm

Title: Question about fullscreen
Post by: waxx on June 21, 2012, 04:38:13 pm
Hi. My question will be about SFML 1.6

Here's what I want to achieve:

Orginal window: 1024x768
After fullscreen: 1920x1080 window with 1440x1080 (keeping orginal 4:3) game in the middle with two black vertical bars on top of which I'll render fillers.

This is prettty common resizing option for many casual games found in bigfishgames. Wondering how can I achieve it in SFML. Thanks.
Title: Re: Question about fullscreen
Post by: eXpl0it3r on June 21, 2012, 04:44:37 pm
My question will be about SFML 1.6

Why? Use SFML 2.0rc it has only advantages! :D

Wondering how can I achieve it in SFML. Thanks.

Have you even taken a look at the documentation/tutorials? To change from window mode to fullscreen or the other way around you just need the Create(...) (http://www.sfml-dev.org/documentation/1.6/classsf_1_1Window.php#aa891f1cbd7d77c4dc02ac950b6e76f61) function from the sf::Window/sf::RenderWindow.
The documentation, the tutorials and the examples explain this pretty well... ;)
Title: Re: Question about fullscreen
Post by: Celtic Minstrel on June 21, 2012, 04:49:34 pm
I think he's asking how he can change the aspect ratio of the window while preserving the aspect ratio of the main viewport. I don't really know how it would be done; might it involve glScissors?
Title: Re: Question about fullscreen
Post by: eXpl0it3r on June 21, 2012, 04:56:58 pm
Ah sorry then I didn't understand it right. ::)

This can be easily achieved with changes in the sf::View (http://www.sfml-dev.org/documentation/1.6/classsf_1_1View.php).
I'll soon publish a tutorial on sf::View if you don't understand how it works or how you'd have to use it. ;)

Edit: Article can be found here (http://dev.my-gate.net/2012/06/using-sfview/)
Title: Re: Question about fullscreen
Post by: waxx on June 21, 2012, 04:57:52 pm
My question will be about SFML 1.6

Why? Use SFML 2.0rc it has only advantages! :D

Wondering how can I achieve it in SFML. Thanks.

Have you even taken a look at the documentation/tutorials? To change from window mode to fullscreen or the other way around you just need the Create(...) (http://www.sfml-dev.org/documentation/1.6/classsf_1_1Window.php#aa891f1cbd7d77c4dc02ac950b6e76f61) function from the sf::Window/sf::RenderWindow.
The documentation, the tutorials and the examples explain this pretty well... ;)

I'm glad you read my therad and you answered my question.
Not.

My project is already big so I can't move to 2.0 >.>

@up
That's cool. Looking forward to it.
Title: Re: Question about fullscreen
Post by: waxx on June 22, 2012, 07:52:51 pm
I read your article.
There's no SetViewport in SFML 1.6 for sf::View though. What do?
Title: Re: Question about fullscreen
Post by: eXpl0it3r on June 22, 2012, 09:32:34 pm
Use SFML 2.0! :P
Those that fear refactoring are already doomed. ;)

No joking aside, I've no idea which function has the same effect in SFML 1.6, but there aren't too many functions. (Doc (http://www.sfml-dev.org/documentation/1.6/classsf_1_1View.php))
If I had to guess, I'd go with SetFromRect(...)
Title: Re: Question about fullscreen
Post by: Laurent on June 22, 2012, 09:40:31 pm
There's no viewport in SFML 1.6, you must more or less hack to simulate the same result.