Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Fullscreen resolution scale
- - By plaristote Date 2012-04-19 14:05
Greetings !

I'm facing a difficult problem and I'm wondering if there isn't builtin ways to solve it.

Thing is, I want the game to use one single "virtual" resolution. And use Gosu to scale it to the actual resolution of the window (which will be fullscreen, so it kinda already does that automatically).
Problem is, the fullscreen doesn't keep the scale ratio proportional (and it looks quite ugly). And I want it to do so (like when you wath a movie on a screen that doesn't fit, you end up with black borders on the sides of the screen).

I would like to know if Gosu can already help me do that ?
And if not, what would be the simplest way to do it ?

Thank you !

EDIT: I found this in Google, it doesn't give any solution for this case, but it shows exactly what I want to obtain :
In case I failed to explain the issue properly. Just look at the three images at the bottom of the page.
Parent - By jlnr (dev) Date 2012-04-19 16:49
You can do what Gosu *should* do — and I hope, one day will do:

• Use fullscreen at the desktop resolution: Gosu::screen_width/height
• Figure out the aspect ratio and position/size of black bars from that
• Wrap your rendering code in scale/translate transforms
• Either use clip_to(...) to clip off stuff where black bars should be; or render black bars over everything else manually
• Normalize mouse_x/y if you support mouse input

(I have used the Ruby method names here, the equivalent in C++ should be easy to find.)

And if it is halfway reusable, please share a link to the code later. :)
Up Topic Gosu / Gosu Exchange / Fullscreen resolution scale

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill