pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
773 stars 120 forks source link

Add example for retro scaling #2785

Closed snowfruit closed 2 months ago

snowfruit commented 3 months ago

Add file "retro_scaling.py" that shows how to render to a surface and scale it to achieve a retro look.

robertpfeiffer commented 3 months ago

Hmm. As is, this duplicates existing functionality, but it could be useful as a "Rosetta Stone" if we add another example based on Window and Texture, to show how one would to this with SDL2 machinery.

snowfruit commented 3 months ago

Hello, thanks for contributing! 🥳

We use black for keeping our code formatted, please run python3 setup.py format and commit the resulting changes.

I thought I did. I will try again.

snowfruit commented 3 months ago

Hmm. As is, this duplicates existing functionality, but it could be useful as a "Rosetta Stone" if we add another example based on Window and Texture, to show how one would to this with SDL2 machinery.

Are you referring to pygame.SCALED?

robertpfeiffer commented 3 months ago

Yeah, if you're up for it. As is, there are many use cases deliberately not covered by SCALED, and rather than having people poke around in the innards of the display module like @Matiiss likes to do (which could break at any time with the next release), it would make more sense to implement SCALED on top of pygame.Window. Maybe somebody wants to have the background a repeating pattern instead of black, or a nine-patch pattern, or just a different colour. Maybe somebody wants to use SCALED but really, really wants to control the size of the window. Something like that is probably within your abilities (you already did it once) and could be really useful.

snowfruit commented 3 months ago

Yeah, if you're up for it. As is, there are many use cases deliberately not covered by SCALED, and rather than having people poke around in the innards of the display module like @Matiiss likes to do (which could break at any time with the next release), it would make more sense to implement SCALED on top of pygame.Window. Maybe somebody wants to have the background a repeating pattern instead of black, or a nine-patch pattern, or just a different colour. Maybe somebody wants to use SCALED but really, really wants to control the size of the window. Something like that is probably within your abilities (you already did it once) and could be really useful.

I have no idea how that would be done. I don't have the skills. But my code here https://github.com/snowfruit/pygame-addons/tree/main/pygame-screen might spark some ideas for a person who knows how. Edited text and link after update.

snowfruit commented 3 months ago

Hello, thanks for contributing! 🥳

We use black for keeping our code formatted, please run python3 setup.py format and commit the resulting changes.

I did the python3 setup.py format on the file. I used the web-interface and hope the file is in the right format now. I think the next step is to press the "Re-request review"-button so that's what I will do.