comparison pyntnclick/main.py @ 569:0587f11ff435 pyntnclick

Link up Resource module.
author Simon Cross <hodgestar+bzr@gmail.com>
date Sat, 11 Feb 2012 15:40:40 +0200
parents aae75f7ce7a1
children 9c3528c2cbe5
comparison
equal deleted inserted replaced
568:aae75f7ce7a1 569:0587f11ff435
19 from pyntnclick.menu import MenuScreen 19 from pyntnclick.menu import MenuScreen
20 from pyntnclick.gamescreen import GameScreen 20 from pyntnclick.gamescreen import GameScreen
21 from pyntnclick.endscreen import EndScreen 21 from pyntnclick.endscreen import EndScreen
22 from pyntnclick.constants import ( 22 from pyntnclick.constants import (
23 SCREEN, FRAME_RATE, DEBUG) 23 SCREEN, FRAME_RATE, DEBUG)
24 from pyntnclick.resources import Resources
24 from pyntnclick.sound import Sound 25 from pyntnclick.sound import Sound
25 from pyntnclick import state, data 26 from pyntnclick import state, data
26 27
27 28
28 class MainShell(Shell): 29 class MainShell(Shell):
45 INITIAL_SCENE = None 46 INITIAL_SCENE = None
46 47
47 # list of game scenes 48 # list of game scenes
48 SCENE_LIST = None 49 SCENE_LIST = None
49 50
51 # resource module
52 RESOURCE_MODULE = "Resources"
53
50 def __init__(self): 54 def __init__(self):
51 if self.INITIAL_SCENE is None: 55 if self.INITIAL_SCENE is None:
52 raise GameDescriptionError("A game must have an initial scene.") 56 raise GameDescriptionError("A game must have an initial scene.")
53 if not self.SCENE_LIST: 57 if not self.SCENE_LIST:
54 raise GameDescriptionError("A game must have a non-empty list" 58 raise GameDescriptionError("A game must have a non-empty list"
55 " of scenes.") 59 " of scenes.")
56 self._initial_scene = self.INITIAL_SCENE 60 self._initial_scene = self.INITIAL_SCENE
57 self._scene_list = self.SCENE_LIST 61 self._scene_list = self.SCENE_LIST
62 self._resource_module = self.RESOURCE_MODULE
58 self._debug_rects = False 63 self._debug_rects = False
59 # TODO: make these real objects 64 self.resource = Resources(self._resource_module)
60 self.resource = object()
61 self.sound = Sound(self.resource) 65 self.sound = Sound(self.resource)
62 66
63 def initial_state(self): 67 def initial_state(self):
64 """Create a copy of the initial game state.""" 68 """Create a copy of the initial game state."""
65 initial_state = state.GameState(self) 69 initial_state = state.GameState(self)