diff pytouhou/game/background.py @ 29:afa91be769ae

Don't lose time updating off-screen enemies' sprites
author Thibaut Girka <thib@sitedethib.com>
date Fri, 12 Aug 2011 22:03:34 +0200
parents f17122405121
children a10e3f44a883
line wrap: on
line diff
--- a/pytouhou/game/background.py
+++ b/pytouhou/game/background.py
@@ -55,7 +55,8 @@ class Background(object):
             for script_index, ox, oy, oz, width_override, height_override in obj.quads:
                 #TODO: per-texture rendering
                 anm, sprite = self.anm_wrapper.get_sprite(script_index)
-                sprite.update(width_override, height_override)
+                if sprite.update():
+                    sprite.update_uvs_vertices(width_override, height_override)
                 uvs, vertices = sprite._uvs, tuple((x + ox, y + oy, z + oz) for x, y, z in sprite._vertices)
                 faces.append((vertices, uvs))
             self.objects.append(faces)