However, after doing this my FrameListener never worked. I took a look at this page on OGRE How-to's and it says that:Now we need to make some changes to TutorialFrameListener. There are a number of ways the FrameListener could have been setup. We created it as a separate class. We could of instead, also had the TutorialApplication inherit from ExampleFrameListener, and that would of saved us from having to pass the scene nodes. But, no, I did not do it the simple way. This time at least. Go to our method TutorialApplication::createFrameListener(), we need to add the two new scene node in the following way, so go ahead and make the changes:
mFrameListener = new TutorialFrameListener(
mWindow, mCamera, mControlNode, mShipNode, mCameraNode );
That does it for working in TutorialApplication.cpp and TutorialApplication.h.
So the part of theYou must also register your FrameListener to the Root. This can be done in the createFrameListener()-function of the class that is derived from ExampleApplication. You can register as many FrameListeners to the root as you want. It will look something like this:
void createFrameListener(void)
{
MyFrameListener listener = new MyFrameListener(mWindow, mCamera);
mRoot->addFrameListener(listener);
}
Code: Select all
mRoot->addFrameListener(listener);