We are going to use the knowledge about user input and frame listeners that we have seen in Chapter 3,Camera, Light, and Shadow
Our application needs
FrameListener
. Add a new private variable to store the pointer to the application:Ogre::FrameListener* FrameListener;
In the same way,
FrameListener
should also be inited withNULL:
Example79() { FrameListener = NULL; compListener = NULL; }
And it should be destroyed in the same way:
~Example79() { if(compListener) { delete compListener; } if(FrameListener) { delete FrameListener; } }
Lets add it and then implement it. The rest of the application class doesn't change:
void createFrameListener() { FrameListener = new Example79FrameListener(mWindow,compListener); mRoot->addFrameListener(FrameListener); }
Before creating the
FrameListener
, we need to modify the compositor listener. It needs a private variable to store the number of pixels that we want our scene to have:class CompositorListener1...