Commits

Ilija Boshkov committed 609841f

Updated to work with OGRE 1.9 (OgreBites Input Context).

  • Participants
  • Parent commits 9c01a2d

Comments (0)

Files changed (2)

Demos/Framework/BaseApplication.cpp

 
     mInputManager = OIS::InputManager::createInputSystem( pl );
 
-    mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
-    mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));
+	mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
+	mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));
+
+#ifdef USE_INPUT_CONTEXT
+	mInputContext.mKeyboard = mKeyboard;
+	mInputContext.mMouse = mMouse;
+#endif
 
     mMouse->setEventCallback(this);
     mKeyboard->setEventCallback(this);
     //Register as a Window listener
     Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);
 
-    mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mMouse, this);
+#ifdef USE_INPUT_CONTEXT
+	mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mInputContext, this);
+#else
+	mTrayMgr = new OgreBites::SdkTrayManager("InterfaceName", mWindow, mMouse, this);
+#endif
+
+    
     mTrayMgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
     mTrayMgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
     mTrayMgr->hideCursor();
         return false;
 
     //Need to capture/update each device
-    mKeyboard->capture();
-    mMouse->capture();
+	mInputContext.capture();
 
     mTrayMgr->frameRenderingQueued(evt);
 

Demos/Framework/BaseApplication.h

 #include <Vehicle/VehicleSetup.h>
 #include <Vehicle/VehicleUtils.h>
 
+#if OGRE_VERSION_MINOR >= 9
+#define USE_INPUT_CONTEXT
+#endif
+
 class BaseApplication : public Ogre::FrameListener, public Ogre::WindowEventListener, public OIS::KeyListener, public OIS::MouseListener, OgreBites::SdkTrayListener
 {
 public:
 
     //OIS Input devices
     OIS::InputManager* mInputManager;
-    OIS::Mouse*    mMouse;
-    OIS::Keyboard* mKeyboard;
+
+#ifdef USE_INPUT_CONTEXT
+	OgreBites::InputContext		mInputContext;
+#endif
+
+	OIS::Mouse*    mMouse;
+	OIS::Keyboard* mKeyboard;
 };
 
 #endif // #ifndef __BaseApplication_h_