Latest File Releases: Mark IV Engine

Sunday, 8 April 2007

Reasons to NOT USE OIS

I have been having some trouble with the OGRE Ehort-Imposed Input Libarary (OIS - the poorly named 'Object Oriented Input System' - shouldn't that be OOIS??)

Mouse position capture is not working 100% under Linux - and look at all this rubbish you have to deal with under Win32:

Important Notes

  • Very Important: If not using Ogre's startRendering() call (ie, using renderOneFrame() or window->update() instead), make sure you pump Win32 messages - this can be done with Ogre's Ogre::WindowEventUtilities::messagePump();. If you forget, you will have wierd behavior with regards to text/shift/capslock.
  • The first call to InputManager::getSingletonPtr() creates (with new) the input manager. Do not forget to destroy it (OIS::InputManager::destroyInputSystem()).
  • Don't forget to capture before every frame!
  • If your renderwindow resizes, you should readjust the Mouse clipping values of mousestate structure.
  • In buffered mode keyboard keys will trigger a call to keyPressed() and keyReleased(). Unbuffered access (or immediate access) to the keyboard keys is obtained via a call to InputManager::getSingletonPtr()->getKeyboard()->isKeyDown(OIS::KC_UP), in this case to test whether the up arrow is pressed. If you are calling capture() outside of FrameStarted(), such as within a main loop, the following hack will trigger a call to keyPressed() with an "unassigned" key. Add two lines to the keyboard handling code within InputManager::capture( void ):
I might go back to SDL for input; it is a mature, reliable multi-platform library and it worked properly before Eihort. The amount of time wasted with OIS, although it is simpler than SDL with its OO style, is very high.

0 comments: