comparison pyntnclick/gamescreen.py @ 616:25f3adbff00a pyntnclick

Note albow callbacks in GameScreen
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 11 Feb 2012 21:33:17 +0200
parents cb01c3a09ee1
children 1a8dceccd98e
comparison
equal deleted inserted replaced
615:cb01c3a09ee1 616:25f3adbff00a
69 self.screen = screen 69 self.screen = screen
70 self.game = screen.game 70 self.game = screen.game
71 self.detail = DetailWindow(screen) 71 self.detail = DetailWindow(screen)
72 72
73 def draw(self, surface): 73 def draw(self, surface):
74 self.animate()
74 if self.game.previous_scene and self.game.do_check == LEAVE: 75 if self.game.previous_scene and self.game.do_check == LEAVE:
75 # We still need to handle leave events, so still display the scene 76 # We still need to handle leave events, so still display the scene
76 self.game.previous_scene.draw(surface, self) 77 self.game.previous_scene.draw(surface, self)
77 else: 78 else:
78 self.game.current_scene.draw(surface, self) 79 self.game.current_scene.draw(surface, self)
241 CursorWidget.enter_screen(self) 242 CursorWidget.enter_screen(self)
242 243
243 def leave_screen(self): 244 def leave_screen(self):
244 CursorWidget.leave_screen(self) 245 CursorWidget.leave_screen(self)
245 246
246 # Albow uses magic method names (command + '_cmd'). Yay. 247 # albow callback:
247 # Albow's search order means they need to be defined here, not in
248 # PopMenu, which is annoying.
249 def hide_cmd(self):
250 # This option does nothing, but the method needs to exist for albow
251 return
252
253 def main_menu_cmd(self): 248 def main_menu_cmd(self):
254 self.shell.show_screen(self.shell.menu_screen) 249 self.shell.show_screen(self.shell.menu_screen)
255 250
251 # albow callback:
256 def quit_cmd(self): 252 def quit_cmd(self):
257 self.shell.quit() 253 self.shell.quit()
258 254
259 def hand_pressed(self): 255 def hand_pressed(self):
260 self.inventory.unselect() 256 self.inventory.unselect()
261 257
262 def begin_frame(self):
263 if self.running:
264 self.state_widget.animate()
265
266 258
267 class DefEndScreen(Screen): 259 class DefEndScreen(Screen):
268 """A placeholder 'Game Over' screen so people can get started easily""" 260 """A placeholder 'Game Over' screen so people can get started easily"""
269 261
270 def setup(self): 262 def setup(self):