Time for action — adding input

Now that we know how the FrameListener works, let's add some input.

  1. We need to include the OIS header file to use OIS:
    #include "OIS\OIS.h"
    
  2. Remove all functions from the FrameListener and add two private members to store the InputManager and the Keyboard:
    OIS::InputManager* _InputManager;
    OIS::Keyboard* _Keyboard;
    
  3. The FrameListener needs a pointer to the RenderWindow to initialize OIS, so we need a constructor, which takes the window as a parameter:
    MyFrameListener(Ogre::RenderWindow* win)
    {
    
  4. 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.