Mercurial > touhou
view pytouhou/resource/anmwrapper.py @ 222:5cac48b328ad
Refactor rendering code a bit.
Move duplicated camera setup code to a new “setup_camera” method,
and move common methods to a new “Renderer” module in order to make
individual sprite rendering easier.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 18 Dec 2011 20:47:48 +0100 |
parents | ac2e5e1c2c3c |
children | dbb1a86c0235 |
line wrap: on
line source
class AnmWrapper(object): def __init__(self, anm_files): self.anm_files = list(anm_files) def get_sprite(self, sprite_index): for anm in self.anm_files: if sprite_index in anm.sprites: return anm, anm.sprites[sprite_index] raise IndexError def get_script(self, script_index): for anm in self.anm_files: if script_index in anm.scripts: return anm, anm.scripts[script_index] raise IndexError