Time for action — adding input
Now that we know how the FrameListener
works, let's add some input.
- We need to include the
OIS
header file to useOIS:
#include "OIS\OIS.h"
- Remove all functions from the
FrameListener
and add two private members to store theInputManager
and theKeyboard:
OIS::InputManager* _InputManager; OIS::Keyboard* _Keyboard;
- The
FrameListener
needs a pointer to theRenderWindow
to initializeOIS
, so we need a constructor, which takes the window as a parameter:MyFrameListener(Ogre::RenderWindow* win) {
-
OIS
will be initialized using a list of parameters, we also need a window handle in string form for the parameter list; create the three needed variables to store the data:OIS::ParamList parameters; unsigned int windowHandle = 0; ...
Get Ogre 3D 1.7 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.