diff options
author | Mateu Batle <mateu.batle@collabora.co.uk> | 2010-11-23 15:33:31 (GMT) |
---|---|---|
committer | Mateu Batle <mateu.batle@collabora.co.uk> | 2010-11-23 15:33:31 (GMT) |
commit | 62eae792b0b392cf111dc95aab3ee520ca9c58f1 (patch) | |
tree | fa127cb3032c67057cd115743142c60b595f0e4e /usmpgames/applicationstate.py | |
parent | 9069351549ac97cebc4816030de42759d6466c25 (diff) |
Implemented cookie system to avoid creation of many objects
Diffstat (limited to 'usmpgames/applicationstate.py')
-rwxr-xr-x | usmpgames/applicationstate.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/usmpgames/applicationstate.py b/usmpgames/applicationstate.py index 6f6439b..ff8613b 100755 --- a/usmpgames/applicationstate.py +++ b/usmpgames/applicationstate.py @@ -6,12 +6,14 @@ from application import * class ApplicationState(): - def __init__(self, next_state = None, background_name = None): + def __init__(self, next_state = None, background_name = None, next_cookie = None): self._running = True self._screen = None self._next_state = next_state + self._next_cookie = next_cookie self._background_name = background_name self._background = None + self._cookie = None def input(self, ms): pass @@ -56,17 +58,22 @@ class ApplicationState(): self.render(ms) self.post_render(ms) - def entering_state(self, fromStack): + def entering_state(self, fromStack, cookie): print "Entering state ", self self.set_running(True) + self._cookie = cookie def exiting_state(self, toStack): print "Exiting state ", self + #self._cookie = None pass def go_to_next_state(self): - Application.instance().change_state( self._next_state ) + Application.instance().change_state( self._next_state, self._next_cookie ) def next_state(self): return self._next_state + def cookie(self): + return self._cookie + |