pygame / pygame

🐍🎮 pygame (the library) is a Free and Open Source python programming language library for making multimedia applications like games built on top of the excellent SDL library. C, Python, Native, OpenGL.
https://www.pygame.org
7.32k stars 3.25k forks source link

additional pixel perfect SCALED display flag #2611

Open SigilQuiver opened 3 years ago

SigilQuiver commented 3 years ago

Currently, the SCALED display flag works differently when the display is in fullscreen/maximized, and when the display is windowed. If the RESIZED flag is enabled, the display uses pixel-perfect scaling unless the window is maximized. If the display is maximized or in fullscreen, the display surface stretches the image to fit the smallest dimension of the screen.

It would be useful if there were two SCALED flags - one for a stretch scale and another for pixel perfect scale.

ghost commented 3 years ago

I think it's a good idea. I looked at it quickly and it seems possible to override the "pixel-perfect" setting in windowed mode by using the SDL_HINT_RENDER_SCALE_QUALITY environment variable, but fullscreen always sets SDL_RenderSetIntegerScale to false to "stretch" the image. 🤷‍♂️

1365

robertpfeiffer commented 3 years ago

Yeah. The behaviour is intentional (maximising screen use when maximised), but I see no harm in making this configurable, as long as the current defaults stay in place. EDIT: I see this as a low priority though.

FinFetChannel commented 1 year ago

I think it's a good idea. I looked at it quickly and it seems possible to override the "pixel-perfect" setting in windowed mode by using the SDL_HINT_RENDER_SCALE_QUALITY environment variable, but fullscreen always sets SDL_RenderSetIntegerScale to false to "stretch" the image. 🤷‍♂️

1365

How do I set this SDL_HINT_RENDER_SCALE_QUALITY variable to false from Pygame? [EDIT]

os.environ['SDL_HINT_RENDER_SCALE_QUALITY'] = '0'

This partially solves an issue I found on android, which is caused by a bug that makes apps with FULLSCREEN always landscape, so i can only use SCALED. Unfortunately, doesn't seem to work on some cheap devices with android go, like my nephew's tablet with the RK3326 chipset.

FinFetChannel commented 1 year ago

Would be nice to have more flexible options, maybe like SCALE_NEAREST and SCALE_CUBIC, as it is, the SCALE flag can be a bit frustrating sometimes, and there is no specification of what exactly it does.