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
780 stars 123 forks source link

Add logos to standard package data files #2976

Open MyreMylar opened 2 weeks ago

MyreMylar commented 2 weeks ago

From a PR on changing the logos:

Please update: https://github.com/pygame-community/pygame-ce/blob/6f7aeea6e4ef9f9fd6f67e56bf63ea77e9a1d961/src_py/meson.build#L30-L33

data_files = files( 
    'freesansbold.ttf', 
    'pygame_icon.bmp', 
    'pygame_ce_logo.png',
    'pygame_ce_powered.png',
) 

(and include copies of bundled images in src_py/ - likely moving those files to a different folder will be needed in the future), so the code could access these images:

import pygame

pygame.init()
powered_splash = pygame.image.load(pygame.pkgdata.getResource("pygame_ce_powered.png"))

Originally posted by @gresm in https://github.com/pygame-community/pygame-ce/pull/2965#pullrequestreview-2161522077

MyreMylar commented 2 weeks ago

This would allow users of pygame-ce to easily use the logos in their games - but it would increase the download size of the wheel by the size of the two new PNG files.

ankith26 commented 2 weeks ago

IMO, it is reasonable to not bundle these as "API features" by default. These are high res images that would increase size, and many users may find it undesirable especially if they have usecases like android/wasm/pyinstaller/etc.

It is better for it to be opt-in, where anyone who needs any of the banners/logos can always download it from our docs logos page and bundle it along with their application.

gresm commented 2 weeks ago

Well, if the wheel size matters, then not every binary has to bundle them and also removing these files from distribution should also be trivial (android/wasm/pyinstaller are quite advanced use-cases and also the default icon and the default font is loaded this way, so for these images it should also work).

What's needed to consider is whether a better API for getting these images is needed (like pygame.pkgdata.get_logo()/pygame.pkgdata.get_splash_image(), which could be literally defined as pygame.image.load(pygame.pkgdata.getResource(...))). These changes above are bare minimum to make these images available through code.

I also see another benefit of including these images (besides removing the necessity of downloading them form the website) - quick prototyping. It's often useful to have a default image when writing a game to "see things on the screen" (or testing filter effects). Something like Godot which uses its logo as a default image.