Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to add a wide screen support into a game?  (Read 3471 times)

0 Members and 1 Guest are viewing this topic.

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
How to add a wide screen support into a game?
« 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?

Haikarainen

  • Guest
How to add a wide screen support into a game?
« Reply #1 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

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
How to add a wide screen support into a game?
« Reply #2 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.

WitchD0ctor

  • Full Member
  • ***
  • Posts: 100
    • View Profile
    • http://www.teleforce-blogspot.com
How to add a wide screen support into a game?
« Reply #3 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
John Carmack can Divide by zer0.

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
How to add a wide screen support into a game?
« Reply #4 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
How to add a wide screen support into a game?
« Reply #5 on: August 10, 2011, 11:38:20 am »
Do you use SFML 1.6 or 2.0?
Laurent Gomila - SFML developer

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
How to add a wide screen support into a game?
« Reply #6 on: August 10, 2011, 11:41:17 am »
sfml 2.0

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
How to add a wide screen support into a game?
« Reply #7 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.
Laurent Gomila - SFML developer

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
How to add a wide screen support into a game?
« Reply #8 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
How to add a wide screen support into a game?
« Reply #9 on: August 10, 2011, 12:03:34 pm »
Ok, so you can draw sprites in the default view for stripes.
Laurent Gomila - SFML developer

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
How to add a wide screen support into a game?
« Reply #10 on: August 10, 2011, 12:11:41 pm »
thanks, seems i can do it.

 

anything