Mercurial > boomslang
changeset 560:28f03563f4db pyntnclick
Provide stubby access to sound and resource object from GameDescription on state and scene objects.
author | Simon Cross <hodgestar+bzr@gmail.com> |
---|---|
date | Sat, 11 Feb 2012 14:47:44 +0200 |
parents | b7d8b89de71a |
children | e207dfad0d9e |
files | pyntnclick/main.py pyntnclick/state.py |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pyntnclick/main.py Sat Feb 11 14:42:24 2012 +0200 +++ b/pyntnclick/main.py Sat Feb 11 14:47:44 2012 +0200 @@ -56,10 +56,13 @@ self._initial_scene = self.INITIAL_SCENE self._scene_list = self.SCENE_LIST self._debug_rects = False + # TODO: make these real objects + self.sound = object() + self.resource = object() def initial_state(self): """Create a copy of the initial game state.""" - initial_state = state.GameState() + initial_state = state.GameState(self) initial_state.set_debug_rects(self._debug_rects) for scene in self._scene_list: initial_state.load_scenes(scene)
--- a/pyntnclick/state.py Sat Feb 11 14:42:24 2012 +0200 +++ b/pyntnclick/state.py Sat Feb 11 14:47:44 2012 +0200 @@ -62,7 +62,9 @@ * items * scenes """ - def __init__(self): + def __init__(self, gd): + # game description + self.gd = gd # map of scene name -> Scene object self.scenes = {} # map of detail view name -> DetailView object @@ -238,6 +240,8 @@ self.name = self.NAME if self.NAME is not None else self.FOLDER # link back to state object self.state = state + self.sound = state.gd.sound + self.resource = state.gd.resource # map of thing names -> Thing objects self.things = {} self._background = None