Mercurial > touhou
changeset 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 | d778db08190f |
children | 723a3e67a223 |
files | pytouhou/ui/gamerunner.pyx |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/ui/gamerunner.pyx +++ b/pytouhou/ui/gamerunner.pyx @@ -177,6 +177,7 @@ class GameRunner(GameRenderer): def render_interface(self): + elements = [] interface = self.game.interface interface.labels['framerate'].set_text('%.2ffps' % self.window.clock.get_fps()) @@ -194,17 +195,18 @@ class GameRunner(GameRenderer): if items: # Redraw all the interface - self.render_elements(items) + elements.extend(items) else: # Redraw only changed labels labels = [label for label in labels if label.changed] - self.render_elements(interface.level_start) + elements.extend(interface.level_start) if self.game.boss: - self.render_elements(interface.boss_items) + elements.extend(interface.boss_items) - self.render_elements(labels) + elements.extend(labels) + self.render_elements(elements) for label in labels: label.changed = False