comparison gamelib/gamescreen.py @ 105:65976205fc2d

Rough Stab at basic animation support
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 24 Aug 2010 11:57:06 +0200
parents b5b6cbf556e6
children da547e148532
comparison
equal deleted inserted replaced
104:ae76009a00b5 105:65976205fc2d
85 # Display the message as a modal dialog 85 # Display the message as a modal dialog
86 MessageDialog(result.message, 60).present() 86 MessageDialog(result.message, 60).present()
87 # queue a redraw to show updated state 87 # queue a redraw to show updated state
88 self.invalidate() 88 self.invalidate()
89 89
90 def animate(self):
91 if self.state.animate():
92 # queue a redraw
93 self.invalidate()
94
90 def mouse_move(self, event): 95 def mouse_move(self, event):
91 if not self.subwidgets: 96 if not self.subwidgets:
92 self.state.mouse_move(event.pos) 97 self.state.mouse_move(event.pos)
93 CursorWidget.mouse_move(self, event) 98 CursorWidget.mouse_move(self, event)
94 99
184 189
185 def hand_pressed(self): 190 def hand_pressed(self):
186 self.handbutton.toggle_selected() 191 self.handbutton.toggle_selected()
187 self.inventory.unselect() 192 self.inventory.unselect()
188 193
194 def begin_frame(self):
195 if self.running:
196 self.state_widget.animate()
197
189 def mouse_delta(self, event): 198 def mouse_delta(self, event):
190 w = self.shell.find_widget(event.pos) 199 w = self.shell.find_widget(event.pos)
191 if not isinstance(w, CursorWidget): 200 if not isinstance(w, CursorWidget):
192 mouse.set_visible(1) 201 mouse.set_visible(1)