Thrakbad
17-11-2009 08:34:49
I'm trying to make a demo app with the example framework, but I get a very strange behaviour I fail to understand. This is my code. I just copied it from DemoSkyBox.py and deleted the spaceship. I now want the camera to stop moving wit the mouse. In the CEGUI Demo this is done by setting MenuMode in the Framelistener, but that didn't work for me. So I tried just commenting out the call to the parent frameStarted() method. I would assume, that the application should now do nothing at all, but somehow the sample Framelistener is still active, because the camera still moves with the mouse and the app reacts to input. I'm no Python crack, but didn't I override the _createFrameListener() and frameStarted() methods so that the old ones won't get called anymore

import sys
sys.path.insert(0,'..')
import PythonOgreConfig
import ogre.renderer.OGRE as ogre
import SampleFramework as sf
import ogre.io.OIS as OIS
class RaycastingApplication(sf.Application):
sceneManager = self.sceneManager
sceneManager.ambientLight = ogre.ColourValue(0.5, 0.5, 0.5)
sceneManager.setSkyBox(True, "Examples/SpaceSkyBox")
# Need a light
light = sceneManager.createLight('MainLight')
light.setPosition (20, 80, 50)
def _createFrameListener(self):
self.frameListener = RaycastingListener(self.renderWindow, self.camera, self.sceneManager)
self.root.addFrameListener(self.frameListener)
class RaycastingListener(sf.FrameListener):
def __init__(self, renderWindow, camera, sceneManager):
sf.FrameListener.__init__(self, renderWindow, camera)
self.sceneManager = sceneManager
def frameStarted(self, frameEvent):
#return sf.FrameListener.frameStarted(self, frameEvent)
return True
if __name__ == '__main__':
try:
application = RaycastingApplication()
application.go()
except ogre.OgreException, e:
print e