[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Fixed aspect ratio scaling



"John Eriksson" <john@xxxxxxxxxxxx> asked:

> Does anyone know about a good solution on the stretching problem when
> running in fullscreen mode on a widescreen monitor?

One thing I would do would be to inspect the available resolutions. On my
widescreen laptop, I get the familiar 800x600 and friends (4:3 aspect
ratio), and some unfamiliar widescreen resolutions (16:9, I think). If all
the resolutions supported by the card are 4:3, you can bail out and stop
doing anything special.

If you have some 16:9 (or crazier) resolutions, I would filter out all the
4:3 options, assuming that they're undesirable relics.

> I guess it might be possible to solve this using code, creating a
> correct sized display and then blitt the game screen to it's centered.

By "correct sized display", you mean having an off-screen buffer of a
fixed 4:3 resolution (e.g. 800x600), and then blit that? It could work,
assuming you're OK with the "inverse letterbox" black bars on the side,
and if you can guarantee that there's going to be a resolution of the
right height on the player's device (1067x600, in this case).

> But this (I guess) can cause some performance loss. And I don't know if
> it's even possible to detect the best screen resolution to use.

Yeah, that ought to be a decision by the player, rather than some guess by
code, I imagine.

One other thing to consider - what if the monitor is in "portrait" mode?
If you look through the available resolutions and see 3:4 or 9:16 aspect
ratios, it seems like a good solution is even more important - a little
stretching between 4:3 and 16:9 looks bad, but I imagine it'd look
terrible between 4:3 and 3:4.

-Dave LeCompte