SFML community forums

Help => Window => Topic started by: dydya-stepa on August 02, 2011, 09:09:29 pm

Title: How to add a wide screen support into a game?
Post by: dydya-stepa on August 02, 2011, 09:09:29 pm
what do i need to be able to support a wide screen resolution? currently my game is for 1024*768. it's a match 3 so my world is kind of inside 1024*768. I want to draw 2 additional images on sides to make the screen wider but not sure how to change coordinates and so on.

Any help?
Title: How to add a wide screen support into a game?
Post by: Haikarainen on August 05, 2011, 06:53:00 pm
It's when you create your renderwindow lol.

sf::RenderWindow(sf::VideoMode(1920,1080,32), "Windowtitle here");

Notice where you put your wanted resolution ? ;)

You should read up on some sfml basics
Title: How to add a wide screen support into a game?
Post by: dydya-stepa on August 09, 2011, 06:54:33 pm
ok, i know how to set the resolution.

the question is about how to render then. When i have a normal resolution i render from (0,0) but when i will setup a widescreen i need to render two stripes on both sides and also the same picture i render in normal mode but scaled to fit the wide screen.

See - normal mode 1024*768 - just my game
wide screen mode - left stripe - my game (scaled as 1024 will be too low) - right stripe.

So the question is how to easily do it with sfml.
Title: How to add a wide screen support into a game?
Post by: WitchD0ctor on August 10, 2011, 02:35:56 am
Im not sure I understand,
are you saying you WANT the left and right strips? how how to get rid of them? (when you set up the render window to be widescreen, it wont be 1024 scaled, it will be 1900, or what ever you set it too
Title: How to add a wide screen support into a game?
Post by: dydya-stepa on August 10, 2011, 11:23:39 am
ok, again:

1) my game must run in 1024*768 and 1920*1080
2) i plan to have all my graphics in 1024*768 (statically created background image takes all screen space in 1024 mode)
3) i need to add support for the wide mode.
4) to do this i will have to scale a bit my 1024 images a bit. But also to avoid improper stretching of images i need to have 2 more images - stripes on both sides

when in full screen mode you get 2 stripes on both sides to avoid distortion of your game. that's how most casual games solve this problem because you can't just change resolution as you don't have "game world" (only background image) like in tile games.
Title: How to add a wide screen support into a game?
Post by: Laurent on August 10, 2011, 11:38:20 am
Do you use SFML 1.6 or 2.0?
Title: How to add a wide screen support into a game?
Post by: dydya-stepa on August 10, 2011, 11:41:17 am
sfml 2.0
Title: How to add a wide screen support into a game?
Post by: Laurent on August 10, 2011, 11:56:56 am
Ok, so maybe the simplest solution would be to use the Viewport property of sf::View, to define the area where the contents of the zone is displayed in the target window. This way you can setup a 1024x768 view that is displayed in the center of the window, instead of being stretched. To get stripes on left and right sides, just clear the background with black color first.
Title: How to add a wide screen support into a game?
Post by: dydya-stepa on August 10, 2011, 11:59:08 am
the stripes should be also images not just black, they will serve as the extensions of center image
Title: How to add a wide screen support into a game?
Post by: Laurent on August 10, 2011, 12:03:34 pm
Ok, so you can draw sprites in the default view for stripes.
Title: How to add a wide screen support into a game?
Post by: dydya-stepa on August 10, 2011, 12:11:41 pm
thanks, seems i can do it.