Up until now, we only had one class, namely, ExampleApplication
. This time we need another one:
Create a new class, name it
Example25FrameListener
, and let it inherit publicly fromOgre::FrameListener:
class Example25FrameListener : public Ogre::FrameListener { };
Add a private member variable, which is an
Ogre::SceneNode
pointer, and name it_node:
private: Ogre::SceneNode* _node;
Add a public constructor that takes an
Ogre::SceneNode
pointer as a parameter and assigns it to the member node pointer:public: Example25FrameListener(Ogre::SceneNode* node) { _node = node; }
Add a new function called
frameStarted(FrameEvent & evt)
, which translates the member node with (0,0,0.1) and then returnstrue:
bool frameStarted(const Ogre::FrameEvent &evt) { _node->translate(Ogre::Vector3(0.1,0,0)); return true; }
Add a new member variable to hold the pointer to the
FrameListener
, which we will create later:Ogre::FrameListener* FrameListener...