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

Author Topic: Supporting multiple resolutions  (Read 3163 times)

0 Members and 1 Guest are viewing this topic.

flashrocket

  • Newbie
  • *
  • Posts: 21
    • View Profile
Supporting multiple resolutions
« on: April 19, 2015, 02:35:03 pm »
Hello, I'm tying to write a game and I found problem.Supporting multiple resolutions.
  • What is the best way to do this?
I created an implementation but it had a problem.
I created a small sized sf::View(800x600) and scaled it into a large screen(1366x768)
But during the up scaling I noticed that drawable objects such as sf::CircleShape were crisp while sf::Text was pixelated.
(click to show/hide)
If this is a good implementation then
  • Why does this happen?
  • How do I fix it?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Supporting multiple resolutions
« Reply #1 on: April 19, 2015, 03:12:30 pm »
Quote
Why does this happen?

Because sf::Text is drawn using textures, and when textures are scaled unless some magical data is added to the texture the limited information available must be scaled up. Shapes on the other hand are drawn using vertices and the GPU is responsible for filling in the pixels between the points thus no scaling is required.

Quote
How do I fix it?

You are scaling a texture, do the fix for not scaling a texture.

(click to show/hide)
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

flashrocket

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Supporting multiple resolutions
« Reply #2 on: April 19, 2015, 03:37:02 pm »
Quote
(click to show/hide)
Do you mean to say
  • create a large view and downscale it
  • change the character size on each change in resolution while using a native sized view
Is there any alternate method of supporting multi-resolution.
« Last Edit: April 19, 2015, 03:38:55 pm by flashrocket »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Supporting multiple resolutions
« Reply #3 on: April 19, 2015, 03:44:38 pm »
The options I can think of are:

 You can scale things.

 You can have pre-created images for different resolutions.

 You can use vector graphics that are effectively resolution independent.

 You can keep your images at one resolution and letterbox when resolution goes up.

I can't really think of other possibilities atm, but please prove me wrong and add some more ;-)

flashrocket

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Supporting multiple resolutions
« Reply #4 on: April 19, 2015, 04:14:44 pm »
Quote
You can scale things.
Can you please be more specific. Upscaling? Downscaling? Scale What?(Views or textures)

Quote
You can use vector graphics that are effectively resolution independent.
I'm trying to use fonts(truetype) I think they are vector(https://msdn.microsoft.com/en-us/library/windows/desktop/dd162893(v=vs.85).aspx) Is there some other way?
I thought SVG wasn't supported in SFML?

Quote
You can keep your images at one resolution and letterbox when resolution goes up.
What's a letterbox?

flashrocket

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Supporting multiple resolutions
« Reply #5 on: April 19, 2015, 04:36:26 pm »
After tinkering around I found that setting view to (something)x768 using similar code as below to be useful in resolutions varying from 800x600 to 1366x768
(click to show/hide)

Please do suggest a better solution than this.

 

anything