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

Author Topic: Resolution problem  (Read 3639 times)

0 Members and 1 Guest are viewing this topic.

aanthonyz

  • Newbie
  • *
  • Posts: 17
    • View Profile
Resolution problem
« on: April 24, 2014, 11:44:54 pm »
Hello, im making a game in 1920x1080, all images are to that size etc. How can I make it so people can use different resolutions with the game? If you want a specific example I have a friend who was testing it and has 1366x768.Would I have to make separate images for each resolution I want to support or can I do a scale for everything or a view scale?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Resolution problem
« Reply #1 on: April 25, 2014, 12:12:10 am »
You can scale everything with views, so you won't need separate images for each resolution.  The view tutorial doesn't cover this specific use, but it's very easy to figure out.
« Last Edit: April 25, 2014, 12:13:49 am by Ixrec »

aanthonyz

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Resolution problem
« Reply #2 on: April 25, 2014, 12:27:54 am »
What I was thinking was depending on their resolution change this:

sf::View view(sf::FloatRect(0, 0, 1920, 1080));

to whatever size they have it set at.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Resolution problem
« Reply #3 on: April 25, 2014, 12:40:39 am »
You're getting view and viewport confused.  Read the tutorial carefully.

What you want is a constant view of {0,0,1920,1080} and a constant viewport of {0,0,1,1}.  Neither should change, though you will have to explicitly reset the view every time you recreate the window.

aanthonyz

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Resolution problem
« Reply #4 on: April 25, 2014, 12:45:43 am »
Wait both view and viewport have to change? Now I understand that view has to stay the same 1920x1080 but wouldnt viewport have to change that way it fits the screen?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Resolution problem
« Reply #5 on: April 25, 2014, 01:16:47 am »
Wait both view and viewport have to change?

What isn't clear?

....constant viewport of {0,0,1,1}.  Neither should change...
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

aanthonyz

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Resolution problem
« Reply #6 on: April 25, 2014, 02:42:04 am »
Well now im trying to figure it out. Sorry for my slowness since this is my first graphic programming language.
So both would stay constant and if the screen gets resized just reset the view?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Resolution problem
« Reply #7 on: April 25, 2014, 04:19:03 am »
If all you want is for the screen contents to stretched to whatever resolution the user is using then all you need to do is set the view once at window creation. The only other time you would need to set the view is if you recreate the window.

By default when the window resized nothing will happen to the view, so the view stays the same size and everything gets scaled to fit the window.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

 

anything