comparison 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
comparison
equal deleted inserted replaced
28:f405b947624d 29:afa91be769ae
53 for i, obj in enumerate(self.stage.objects): 53 for i, obj in enumerate(self.stage.objects):
54 faces = [] 54 faces = []
55 for script_index, ox, oy, oz, width_override, height_override in obj.quads: 55 for script_index, ox, oy, oz, width_override, height_override in obj.quads:
56 #TODO: per-texture rendering 56 #TODO: per-texture rendering
57 anm, sprite = self.anm_wrapper.get_sprite(script_index) 57 anm, sprite = self.anm_wrapper.get_sprite(script_index)
58 sprite.update(width_override, height_override) 58 if sprite.update():
59 sprite.update_uvs_vertices(width_override, height_override)
59 uvs, vertices = sprite._uvs, tuple((x + ox, y + oy, z + oz) for x, y, z in sprite._vertices) 60 uvs, vertices = sprite._uvs, tuple((x + ox, y + oy, z + oz) for x, y, z in sprite._vertices)
60 faces.append((vertices, uvs)) 61 faces.append((vertices, uvs))
61 self.objects.append(faces) 62 self.objects.append(faces)
62 63
63 64