00001 #ifndef __IKINPUTHANDLER_H 00002 #define __IKINPUTHANDLER_H 00003 00004 #define OIS_DYNAMIC_LIB 00005 #include "OIS.h" 00006 00007 #include "Application.h" 00008 #include "SelectableObject.h" 00009 00010 typedef enum { 00011 VIEWER, 00012 MENU 00013 } inputState; 00014 00015 class InputHandler:public OIS::MouseListener, public OIS::KeyListener 00016 { 00017 public: 00018 InputHandler(Ogre::RenderWindow* _window); 00019 ~InputHandler(); 00020 00021 void getInput(); 00022 00023 void setWindowSize(int _width, int _height); 00024 00025 bool keyPressed(const OIS::KeyEvent &_event); 00026 bool keyReleased(const OIS::KeyEvent &_event); 00027 bool mouseMoved(const OIS::MouseEvent &_event); 00028 bool mousePressed(const OIS::MouseEvent &_event, OIS::MouseButtonID _button); 00029 bool mouseReleased(const OIS::MouseEvent &_event, OIS::MouseButtonID _button); 00030 00031 inputState getInputState(); 00032 void setInputState(inputState _val); 00033 00034 void destroy(Ogre::RenderWindow* _window); 00035 00036 // Couple of nasty last minute hacks to allow the craft to be auto-selectable. 00037 void forceSelectCraft(); 00038 protected: 00039 OIS::InputManager* m_ois; 00040 OIS::Mouse* m_mouse; 00041 OIS::Keyboard* m_keyboard; 00042 Ogre::RenderWindow* m_window; 00043 00044 inputState m_inputState; 00045 00046 Ogre::RaySceneQuery* m_rayOverlayQuery; 00047 Ogre::RaySceneQuery* m_rayViewerQuery; 00048 00049 Ogre::Any m_preSelected; 00050 Ogre::Any m_selected; 00051 00052 }; 00053 00054 #endif