In my application, I switch between usin buffered and unbuffered input... When I have a Gui up that needs input, I switch to buffered, and when it's gone, go back to unbuffered. Here's how I setup up my input:
Code: Select all
m_EventProcessor = new Ogre::EventProcessor();
m_EventProcessor->initialise( GraphicsSystem::getSingleton().getRenderWindow() );
m_EventProcessor->startProcessingEvents();
m_InputDevice = m_EventProcessor->getInputReader();
m_UseBufferedKeyBoard = false;
m_UseBufferedMouse = false;
m_InputDevice->setBufferedInput(m_UseBufferedKeyBoard, m_UseBufferedMouse);
And here is how I switch between buffered/unbuffered:
Code: Select all
void InputSystem::setBufferedInputMode( bool bMouse, bool bKeyBoard )
{
if( bMouse != m_UseBufferedMouse || bKeyBoard != m_UseBufferedKeyBoard)
{
m_UseBufferedMouse = bMouse;
m_UseBufferedKeyBoard = bKeyBoard;
m_InputDevice->setBufferedInput(m_UseBufferedKeyBoard, m_UseBufferedMouse);
}
}
And wether or not I'm in buffered mode, I can still poll the keys with;
m_InputDevice->capture();
if( m_InputDevice->isKeyDown(Ogre::KC_ESCAPE) )
quit();
And to use buffered, you just have to add and remove mouseListeners/mouseMotionListeners/ and/or keylisteners as you need them using the methods provided in m_EventProcessor.
Hope this helps you out