Mercurial > touhou
comparison pytouhou/ui/gamerunner.pyx @ 438:43a8fed9a8d8
Make only one call to render_elements during interface rendering.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 11 Aug 2013 14:30:52 +0200 |
parents | 878273a984c4 |
children | 6864a38b2413 |
comparison
equal
deleted
inserted
replaced
437:d778db08190f | 438:43a8fed9a8d8 |
---|---|
175 | 175 |
176 glDisable(GL_SCISSOR_TEST) | 176 glDisable(GL_SCISSOR_TEST) |
177 | 177 |
178 | 178 |
179 def render_interface(self): | 179 def render_interface(self): |
180 elements = [] | |
180 interface = self.game.interface | 181 interface = self.game.interface |
181 interface.labels['framerate'].set_text('%.2ffps' % self.window.clock.get_fps()) | 182 interface.labels['framerate'].set_text('%.2ffps' % self.window.clock.get_fps()) |
182 | 183 |
183 if self.use_fixed_pipeline: | 184 if self.use_fixed_pipeline: |
184 glMatrixMode(GL_MODELVIEW) | 185 glMatrixMode(GL_MODELVIEW) |
192 items = [item for item in interface.items if item.anmrunner and item.anmrunner.running] | 193 items = [item for item in interface.items if item.anmrunner and item.anmrunner.running] |
193 labels = interface.labels.values() | 194 labels = interface.labels.values() |
194 | 195 |
195 if items: | 196 if items: |
196 # Redraw all the interface | 197 # Redraw all the interface |
197 self.render_elements(items) | 198 elements.extend(items) |
198 else: | 199 else: |
199 # Redraw only changed labels | 200 # Redraw only changed labels |
200 labels = [label for label in labels if label.changed] | 201 labels = [label for label in labels if label.changed] |
201 | 202 |
202 self.render_elements(interface.level_start) | 203 elements.extend(interface.level_start) |
203 | 204 |
204 if self.game.boss: | 205 if self.game.boss: |
205 self.render_elements(interface.boss_items) | 206 elements.extend(interface.boss_items) |
206 | 207 |
207 self.render_elements(labels) | 208 elements.extend(labels) |
209 self.render_elements(elements) | |
208 for label in labels: | 210 for label in labels: |
209 label.changed = False | 211 label.changed = False |
210 | 212 |