We have already created our camera; now we are going to use it in combination with user input as follows:
Extend the constructor of the
Framelistener
to get a pointer to our camera:Example30FrameListener(Ogre::SceneNode* node,RenderWindow* win,Ogre::Camera* cam)
Also add a member variable for storing the camera pointer:
Ogre::Camera* _Cam;
Then assign the parameter to the member:
_Cam = cam;
Modify the instantiation of the
FrameListener
to add the camera pointer:Ogre::FrameListener* FrameListener = new Example30FrameListener(_SinbadNode,mWindow,mCamera);
To move the camera, we need to get mouse input. So create a new member variable for storing the mouse:
OIS::Mouse* _mouse;
In the constructor, init the mouse after the keyboard:
_mouse = static_cast<OIS::Mouse*>(_man->createInputObject( OIS::OISMouse, false ));
Now as we have the mouse, we also need to capture the mouse state as we did with the keyboard. Add this line after the call for...