resources¶
resources¶
Resource-loading utilities for AsteroidImpact
-
class
resources.MixedSound(filename, mixing_group, default_volume)¶ Bases:
SoundSound object that reduces volume when self or other sounds in same group are played at simultaneously.
-
play()¶
-
-
class
resources.NoneSound¶ Stub sound object that responds to same methods but plays no audio
-
fadeout(duration)¶
-
get_length()¶
-
get_volume()¶
-
play()¶
-
set_volume(volume)¶
-
stop()¶
-
-
class
resources.ScaledImageCache(name, convert_alpha=False, colorkey=None)¶ Bases:
objectCache of image resources for different sizes.
Make scaled images available more quickly by scaling them from a closer size to the requested size than the image on disk. Cache the results for later.
-
get(size)¶ Return a cached previously scaled image
or scale the image from the most suitable size if the size has not been requested before.
-
-
resources.load_font(name, size)¶ Load pygame font for specified filename, font size
-
resources.load_image(name, size=None, convert_alpha=False, colorkey=None)¶ Load image, scaling to desired size if specified.
Results are cached to make future loading of the same resource instant, but this means you shouldn’t draw on returned surfaces.
-
resources.load_music(name)¶ Load music file from file name.
-
resources.load_sound(name, mixing_group=None)¶ Load audio clip from file name.
mixing_group is key for which group the sound should mix with. Mixed sounds in the same group reduce in volume based on how many are currently playing.
-
resources.mute_music()¶ Mute Music by setting volume to zero temporarily.
-
resources.resource_path(filename)¶ Return transformed resource path.
For example, a standalone single-exe build would need to move the ‘data’ folder references somewhere else.
-
resources.unmute_music()¶ Restore music volume to configured music volume.