Mercurial > touhou
comparison pytouhou/game/background.py @ 120:4300a832f033
Small refactoring and massive performance improvement
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Thu, 08 Sep 2011 12:46:05 +0200 |
parents | 340fcda8e64a |
children | bdcf2077e368 |
comparison
equal
deleted
inserted
replaced
119:fad7b44cebf2 | 120:4300a832f033 |
---|---|
49 def build_models(self): | 49 def build_models(self): |
50 self.models = [] | 50 self.models = [] |
51 for obj in self.stage.models: | 51 for obj in self.stage.models: |
52 quads = [] | 52 quads = [] |
53 for script_index, ox, oy, oz, width_override, height_override in obj.quads: | 53 for script_index, ox, oy, oz, width_override, height_override in obj.quads: |
54 sprite = Sprite() | 54 sprite = Sprite(width_override, height_override) |
55 anm_runner = ANMRunner(self.anm_wrapper, script_index, sprite) | 55 anm_runner = ANMRunner(self.anm_wrapper, script_index, sprite) |
56 anm_runner.run_frame() | 56 anm_runner.run_frame() |
57 sprite.update(width_override, height_override) | |
58 quads.append((ox, oy, oz, width_override, height_override, sprite)) | 57 quads.append((ox, oy, oz, width_override, height_override, sprite)) |
59 self.anm_runners.append(anm_runner) | 58 self.anm_runners.append(anm_runner) |
60 self.models.append(quads) | 59 self.models.append(quads) |
61 | 60 |
62 | 61 |
81 | 80 |
82 for anm_runner in tuple(self.anm_runners): | 81 for anm_runner in tuple(self.anm_runners): |
83 if not anm_runner.run_frame(): | 82 if not anm_runner.run_frame(): |
84 self.anm_runners.remove(anm_runner) | 83 self.anm_runners.remove(anm_runner) |
85 | 84 |
86 for model in self.models: | |
87 for ox, oy, oz, width_override, height_override, sprite in model: | |
88 sprite.update(width_override, height_override) | |
89 | |
90 self.position2_interpolator.update(frame) | 85 self.position2_interpolator.update(frame) |
91 self.fog_interpolator.update(frame) | 86 self.fog_interpolator.update(frame) |
92 self.position_interpolator.update(frame) | 87 self.position_interpolator.update(frame) |
93 | 88 |