Ejemplo n.º 1
0

def load():
    global sounds, images, music, loaded

    if loaded:
        logger.debug('want to load resources, but already have')
        return

    logger.debug('loading resources...')

    sounds = dict()
    images = dict()
    music = dict()

    if Config.has_section('sound-files'):
        vol = Config.getint('sound', 'sound-volume') / 100.
        for name, filename in Config.items('sound-files'):
            path = jpath(resource_path, 'sounds', filename)
            logger.info("loading %s", path)
            sound = pygame.mixer.Sound(path)
            sound.set_volume(vol)
            sounds[name] = sound

    if Config.has_section('image-files'):
        for name, filename in Config.items('image-files'):
            path = jpath(resource_path, 'images', filename)
            logger.info("loading %s", path)
            # image = pygame.image.load(path)
            #images[name] = image