Time for action — adding input support
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:
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.