Mercurial > pyntnclick
changeset 314:63e702d93e0e
Call detail enter and leave hooks
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sat, 28 Aug 2010 12:10:20 +0200 |
parents | 40dd77f71e11 |
children | 7b07ffc37ec0 |
files | gamelib/gamescreen.py gamelib/state.py |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/gamescreen.py Sat Aug 28 09:37:21 2010 +0200 +++ b/gamelib/gamescreen.py Sat Aug 28 12:10:20 2010 +0200 @@ -106,11 +106,13 @@ w, h = self.state.set_current_detail(detail) self.detail.set_image_rect(Rect(0, 0, w, h)) self.add_centered(self.detail) + self.state.do_enter_detail() self.parent.cursor_highlight(False) def clear_detail(self): """Hide the detail view""" self.remove(self.detail) + self.state.do_leave_detail() self.state.set_current_detail(None)
--- a/gamelib/state.py Sat Aug 28 09:37:21 2010 +0200 +++ b/gamelib/state.py Sat Aug 28 12:10:20 2010 +0200 @@ -164,6 +164,14 @@ def interact_detail(self, pos): return self.current_detail.interact(self.tool, pos) + def do_enter_detail(self): + if self.current_detail: + self.current_detail.enter() + + def do_leave_detail(self): + if self.current_detail: + self.current_detail.leave() + def animate(self): if not self.do_check: return self.current_scene.animate()