changeset 25:cc864aadc733

Preload enemy and background textures
author Thibaut Girka <thib@sitedethib.com>
date Fri, 12 Aug 2011 19:25:08 +0200
parents 93aa1b55d97c
children f17122405121
files eclviewer.py pytouhou/opengl/texture.py
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/eclviewer.py
+++ b/eclviewer.py
@@ -61,9 +61,11 @@ def main(path, stage_num):
         else:
             anims.append(enemies2_anim)
         enemy_manager = EnemyManager(stage, AnmWrapper(anims), ecl)
+        texture_manager.preload(anims)
 
         background_anim = Animations.read(BytesIO(archive.extract('stg%dbg.anm' % stage_num)))
         background = Background(stage, AnmWrapper((background_anim,)))
+        texture_manager.preload((background_anim,))
 
         print(enemy_manager.stage.name)
 
--- a/pytouhou/opengl/texture.py
+++ b/pytouhou/opengl/texture.py
@@ -19,6 +19,12 @@ class TextureManager(object):
         return self.textures[key]
 
 
+    def preload(self, anms):
+        for anm in anms:
+            key = anm.first_name, anm.secondary_name
+            texture = self[key]
+
+
     def set_archive(self, archive):
         self.archive = archive