# HG changeset patch # User Simon Cross # Date 1328964464 -7200 # Node ID 28f03563f4db78da4f7f34fcaabbfcf5ed8b21eb # Parent b7d8b89de71adb039bd0a6fbd33ab536fb479622 Provide stubby access to sound and resource object from GameDescription on state and scene objects. diff -r b7d8b89de71a -r 28f03563f4db pyntnclick/main.py --- 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) diff -r b7d8b89de71a -r 28f03563f4db pyntnclick/state.py --- 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