Mercurial > touhou
view pytouhou/resource/anmwrapper.py @ 282:dbb1a86c0235
Rename Animations to ANM0 and prepare AnmWrapper for dialogs and interface.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sat, 11 Feb 2012 16:43:54 +0100 |
parents | ac2e5e1c2c3c |
children | 2100276c289d |
line wrap: on
line source
from itertools import izip, chain, repeat class AnmWrapper(object): def __init__(self, anm_files, offsets=()): self.scripts = {} self.sprites = {} for anm, offset in izip(anm_files, chain(offsets, repeat(0))): for script_id, script in anm.scripts.iteritems(): self.scripts[script_id + offset] = (anm, script) #TODO: check for sprite_id, sprite in anm.sprites.iteritems(): self.sprites[sprite_id + offset] = (anm, sprite) def get_sprite(self, sprite_index): return self.sprites[sprite_index] def get_script(self, script_index): return self.scripts[script_index]