Mercurial > fife-parpg
comparison demos/rio_de_hola/run.py @ 496:987307d12235
Added the fife_settings.py extension. This provides a small utility class for loading and saving settings along with a dialog box for setting screen resolution and other things.
Updated the shooter demo and rio_de_hola to use the new settings extension.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 12 May 2010 16:09:46 +0000 |
parents | e29853880e87 |
children | 3dff106b945b |
comparison
equal
deleted
inserted
replaced
495:ae9f5383f5b1 | 496:987307d12235 |
---|---|
37 from scripts import world | 37 from scripts import world |
38 from scripts.common import eventlistenerbase | 38 from scripts.common import eventlistenerbase |
39 from fife.extensions.basicapplication import ApplicationBase | 39 from fife.extensions.basicapplication import ApplicationBase |
40 from fife.extensions import pychan | 40 from fife.extensions import pychan |
41 from fife.extensions.pychan import widgets | 41 from fife.extensions.pychan import widgets |
42 from settings import Setting | 42 from fife.extensions.fife_settings import Setting |
43 from fife.extensions.fife_utils import getUserDataDirectory | 43 from fife.extensions.fife_utils import getUserDataDirectory |
44 | 44 |
45 TDS = Setting() | 45 TDS = Setting(app_name="rio_de_hola") |
46 | 46 |
47 class ApplicationListener(eventlistenerbase.EventListenerBase): | 47 class ApplicationListener(eventlistenerbase.EventListenerBase): |
48 def __init__(self, engine, world): | 48 def __init__(self, engine, world): |
49 super(ApplicationListener, self).__init__(engine,regKeys=True,regCmd=True, regMouse=False, regConsole=True, regWidget=True) | 49 super(ApplicationListener, self).__init__(engine,regKeys=True,regCmd=True, regMouse=False, regConsole=True, regWidget=True) |
50 self.engine = engine | 50 self.engine = engine |
126 def loadSettings(self): | 126 def loadSettings(self): |
127 """ | 127 """ |
128 Load the settings from a python file and load them into the engine. | 128 Load the settings from a python file and load them into the engine. |
129 Called in the ApplicationBase constructor. | 129 Called in the ApplicationBase constructor. |
130 """ | 130 """ |
131 import settings | |
132 self.settings = settings | |
133 | 131 |
134 engineSetting = self.engine.getSettings() | 132 engineSetting = self.engine.getSettings() |
135 engineSetting.setDefaultFontGlyphs(str(TDS.readSetting("FontGlyphs", strip=False))) | 133 engineSetting.setDefaultFontGlyphs(str(TDS.readSetting("FontGlyphs", strip=False))) |
136 engineSetting.setDefaultFontPath(str(TDS.readSetting("Font"))) | 134 engineSetting.setDefaultFontPath(str(TDS.readSetting("Font"))) |
137 engineSetting.setDefaultFontSize(12) | 135 engineSetting.setDefaultFontSize(12) |