Again, we use the previous code and add the necessary additions to get input support:
We need to add a new parameter to the constructor of our listener. We need a pointer to the render window that Ogre 3D uses to render. To add the new parameter, the code should look like this:
Example27FrameListener(Ogre::SceneNode* node,RenderWindow* win)
When changing the constructor, we also need to change the instantiation:
Ogre::FrameListener* FrameListener = new Example27FrameListener(_SinbadNode,mWindow);
After this, we need to add code into the constructor of the listener. First, we need two helper variables:
size_t windowHnd = 0; std::stringstream windowHndStr;
Now ask Ogre 3D for the window handle it renders to:
win->getCustomAttribute("WINDOW", &windowHnd);
Convert the handle into a string:
windowHndStr << windowHnd;
Create a parameter list for OIS and add the window handle to it:
OIS::ParamList pl; pl.insert(std::make_pair(std::string("WINDOW")...