Retro Game Library Documentation


retrogamelib.util

The util module is a set of functions for loading resources.
util.filepath(path)
Takes a path, e.g. "path/to/file.txt", and converts its slashes to your system's using os.path.join. It's basically a quicker and easier version of os.path.join.
util.load_image(filename)
Loads an image, and caches it. If it's already been loaded, then it will return the previously loaded image. filename should be a path to the image, e.g. "data/image.png" or "data\image.png". Its slashes are converted to your system path's using the filename function.
util.play_sound(filename, volume=1.0)
Plays a sound, and caches it. volume should be the volume of the sound, anything from 0.0 to 1.0. filename should again be a path to the file, which is ran through the filepath function.
util.play_music(filename, loop=0, volume=1.0)
Plays a music file. If you want it to loop, set loop to -1. volume is the volume of the music, anything from 0.0 to 1.0. filename should again be a path to the file, which is ran through the filepath function.


Copyright © 2009, pymike and saluk