comparison pytouhou/ui/sdl/gamerenderer.py @ 549:56bca8ce4b68

Add a very simple sample interface.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 08 Nov 2013 18:48:30 +0100
parents b895ed2de71f
children 0d7a16e0f834
comparison
equal deleted inserted replaced
548:1e9ea6519f3c 549:56bca8ce4b68
73 game.cancelled_bullets, game.items, 73 game.cancelled_bullets, game.items,
74 game.labels)) 74 game.labels))
75 75
76 76
77 def render_interface(self, interface, boss): 77 def render_interface(self, interface, boss):
78 interface.labels['framerate'].set_text('%.2ffps' % self.window.get_fps()) 78 interface_labels = interface.labels
79 if 'framerate' in interface_labels:
80 interface_labels['framerate'].set_text('%.2ffps' % self.window.get_fps())
79 81
80 self.window.win.render_set_viewport(Rect(0, 0, interface.width, interface.height)) 82 self.window.win.render_set_viewport(Rect(0, 0, interface.width, interface.height))
81 self.window.win.render_set_clip_rect(Rect(0, 0, interface.width, interface.height)) 83 self.window.win.render_set_clip_rect(Rect(0, 0, interface.width, interface.height))
82 84
83 items = [item for item in interface.items if item.anmrunner and item.anmrunner.running] 85 items = [item for item in interface.items if item.anmrunner and item.anmrunner.running]
84 labels = interface.labels.values() 86 labels = interface_labels.values()
85 87
86 if items: 88 if items:
87 # Redraw all the interface 89 # Redraw all the interface
88 self.render_elements(items) 90 self.render_elements(items)
89 else: 91 else: