Mercurial > parpg-core
comparison src/parpg/application.py @ 39:8b3890f17f94
FifeManager no longer subclasses ApplicationBase
PARPGApplication stores an instance of tbe manager instead
author | KarstenBock@gmx.net |
---|---|
date | Wed, 03 Aug 2011 22:57:52 +0200 |
parents | 94cb5843dcbb |
children | 0443ab9533ce |
comparison
equal
deleted
inserted
replaced
38:bd1e3b743518 | 39:8b3890f17f94 |
---|---|
17 import sys | 17 import sys |
18 | 18 |
19 from fife import fife | 19 from fife import fife |
20 from fife.extensions import pychan | 20 from fife.extensions import pychan |
21 from fife.extensions.serializers.xmlanimation import XMLAnimationLoader | 21 from fife.extensions.serializers.xmlanimation import XMLAnimationLoader |
22 from fife.extensions.basicapplication import ApplicationBase | |
22 | 23 |
23 from parpg import console, vfs | 24 from parpg import console, vfs |
24 from parpg.font import PARPGFont | 25 from parpg.font import PARPGFont |
25 from parpg.gamemodel import GameModel | 26 from parpg.gamemodel import GameModel |
26 from parpg.mainmenuview import MainMenuView | 27 from parpg.mainmenuview import MainMenuView |
101 @return: None""" | 102 @return: None""" |
102 if(command.getCommandType() == fife.CMD_QUIT_GAME): | 103 if(command.getCommandType() == fife.CMD_QUIT_GAME): |
103 self.quit = True | 104 self.quit = True |
104 command.consume() | 105 command.consume() |
105 | 106 |
106 class PARPGApplication(FifeManager): | 107 class PARPGApplication(ApplicationBase): |
107 """Main Application class | 108 """Main Application class |
108 We use an MVC model model | 109 We use an MVC model model |
109 self.gamesceneview is our view,self.model is our model | 110 self.gamesceneview is our view,self.model is our model |
110 self.controller is the controller""" | 111 self.controller is the controller""" |
111 | 112 |
112 def __init__(self, setting): | 113 def __init__(self, setting): |
113 """Initialise the instance. | 114 """Initialise the instance. |
114 @return: None""" | 115 @return: None""" |
115 self.modes = [] | |
116 self._setting = setting | 116 self._setting = setting |
117 self.manager = FifeManager() | |
117 self.engine = fife.Engine() | 118 self.engine = fife.Engine() |
118 self.loadSettings() | 119 self.loadSettings() |
119 self.engine.init() | 120 self.engine.init() |
120 # KLUDGE M. George Hansen 2011-06-04: See parpg/vfs.py. | 121 # KLUDGE M. George Hansen 2011-06-04: See parpg/vfs.py. |
121 vfs.VFS = self.engine.getVFS() | 122 vfs.VFS = self.engine.getVFS() |
144 self.loadFonts() | 145 self.loadFonts() |
145 self.event_listener = EventListener(self.engine) | 146 self.event_listener = EventListener(self.engine) |
146 controller = MainMenuController(self.engine, self.view, self.model, | 147 controller = MainMenuController(self.engine, self.view, self.model, |
147 self) | 148 self) |
148 #controller.initHud() | 149 #controller.initHud() |
149 self.push_mode(controller) | 150 self.manager.push_mode(controller) |
150 self.listener = ApplicationListener(self.event_listener, | 151 self.listener = ApplicationListener(self.event_listener, |
151 self.engine, | 152 self.engine, |
152 self.view, | 153 self.view, |
153 self.model) | 154 self.model) |
154 #start_map = self._setting.fife.get("PARPG", "Map") | 155 #start_map = self._setting.fife.get("PARPG", "Map") |
209 There are in fact 2 main loops, this one and the one in GameSceneView. | 210 There are in fact 2 main loops, this one and the one in GameSceneView. |
210 @return: None""" | 211 @return: None""" |
211 if self.listener.quit: | 212 if self.listener.quit: |
212 self.breakRequested = True #pylint: disable-msg=C0103 | 213 self.breakRequested = True #pylint: disable-msg=C0103 |
213 else: | 214 else: |
214 FifeManager._pump(self) | 215 self.manager._pump() |