Mercurial > fife-parpg
comparison demos/shooter/run.py @ 495:ae9f5383f5b1
Added a new log module called Script. This should be used by the python modules.
Did some code cleanup and comment cleanup.
Added some more visible log modules to the shooter demo for fun.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 11 May 2010 21:30:55 +0000 |
parents | c4168eb47a44 |
children | 987307d12235 |
comparison
equal
deleted
inserted
replaced
494:e241d7553496 | 495:ae9f5383f5b1 |
---|---|
43 class ApplicationListener(eventlistenerbase.EventListenerBase): | 43 class ApplicationListener(eventlistenerbase.EventListenerBase): |
44 def __init__(self, engine, world): | 44 def __init__(self, engine, world): |
45 super(ApplicationListener, self).__init__(engine,regKeys=True,regCmd=True, regMouse=False, regConsole=True, regWidget=True) | 45 super(ApplicationListener, self).__init__(engine,regKeys=True,regCmd=True, regMouse=False, regConsole=True, regWidget=True) |
46 self._engine = engine | 46 self._engine = engine |
47 self._world = world | 47 self._world = world |
48 engine.getEventManager().setNonConsumableKeys([ | |
49 fife.Key.ESCAPE,]) | |
50 | |
51 self._quit = False | 48 self._quit = False |
52 | 49 |
53 def keyPressed(self, evt): | 50 def keyPressed(self, evt): |
54 keyval = evt.getKey().getValue() | 51 keyval = evt.getKey().getValue() |
55 keystr = evt.getKey().getAsString().lower() | 52 keystr = evt.getKey().getAsString().lower() |
110 def initLogging(self): | 107 def initLogging(self): |
111 """ | 108 """ |
112 Initialize the LogManager. | 109 Initialize the LogManager. |
113 """ | 110 """ |
114 | 111 |
115 LogModules = ["controller",] | 112 logmodules = ["controller", |
116 self._log = fifelog.LogManager(self.engine, 1, 0) | 113 "event channel", |
117 if LogModules: | 114 "audio", |
118 self._log.setVisibleModules(*LogModules) | 115 "model", |
119 | 116 "metamodel", |
117 "pool", | |
118 "vfs", | |
119 "video", | |
120 "view", | |
121 "camera", | |
122 "util", | |
123 "pool", | |
124 "xml", | |
125 "exception", | |
126 "structures", | |
127 "location", | |
128 "native loaders", | |
129 "loaders", | |
130 "gui", | |
131 "script"] | |
132 | |
133 #log to both the console and log file | |
134 self._log = fifelog.LogManager(self.engine, 1, 1) | |
135 if logmodules: | |
136 self._log.setVisibleModules(*logmodules) | |
137 | |
120 def createListener(self): | 138 def createListener(self): |
121 pass # already created in constructor | 139 pass # already created in constructor |
122 | 140 |
123 def _pump(self): | 141 def _pump(self): |
124 if self._listener._quit: | 142 if self._listener._quit: |