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

Author Topic: How to mantain the proportion in full screen (for diferent screens)  (Read 4235 times)

0 Members and 1 Guest are viewing this topic.

reethok

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Email
First at all, sorry for my bad english.

Now, what i want to do is... I create a render window, with... for example, 1024x576, that is 16:9, what can I do so when it switches to full screen, it scales mantaining the proportion and it stop when the width or heigh is filled, centring the image and filling the unoccuped space with black.

If i didnt explained it well, this is a graphic explanation:






Greetings.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
http://en.sfml-dev.org/forums/index.php?topic=10703

Read also the tutorial about views.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

reethok

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Email
Thank you, but that isnt what I want to do exactly.

I dont want to mantain a specific size (for example, 800x600), but to resize mantaining the proportion, in that case 4:3, and just filling with black what dont fit. (As in the images I put in the post).

Greetings.

gostron

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
I'd say it's all the same,

create a View, get the size of your window, get the maximum considering your ratio and create the View of the right size. However changing the view this way will only result in having more or less entities printing on your screen depending on your screen resolution

reethok

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Email
Mmm, they game will be a visual novel, so i need it to escale :S

gostron

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
let's assume you display images of this 1024x768 and your screen size is 1920x1080.

I'd guess that you want a view that goes the maximum size, but of the right ratio.

So in this case i'd go with a view of 1365x768, to keep the right size but to go to the right ratio.

where 1365 = 1024 * (16/9) / (4/3)

and with being extra careful about not drawing anything on the borders (or to overwrite too black rectangles)

Perde

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Thank you, but that isnt what I want to do exactly.

I dont want to mantain a specific size (for example, 800x600), but to resize mantaining the proportion, in that case 4:3, and just filling with black what dont fit. (As in the images I put in the post).

Greetings.

Actually, Nexus reply contained the answer to your question. The part in the view-tutorial you'd want to look at is called "Defining how the view is viewed".

 

anything