/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2006 The OGRE Team Also see acknowledgements in Readme.html You may use this sample code for anything you like, it is not covered by the LGPL like the rest of the engine. ----------------------------------------------------------------------------- */ #ifndef _UIHandler_H_ #define _UIHandler_H_ #include "CEGUI/CEGUI.h" #include "OgreFrameListener.h" #include class ColladaDemo; class UIHandler : public Ogre::FrameListener, public OIS::KeyListener, OIS::MouseListener { #define MINSPEED .150f #define MOVESPEED 30 #define MAXSPEED 1.800f protected: ColladaDemo* mMain; Ogre::Vector3 mTranslateVector; bool mStatsOn; unsigned int mNumScreenShots; float mMoveScale; float mRotScale; float mSpeed; float mAvgFrameTime; int mSceneDetailIndex; Ogre::Real mMoveSpeed; Ogre::Real mRotateSpeed; float mSkipCount; float mUpdateFreq; CEGUI::Point mLastMousePosition; bool mLastMousePositionSet; OIS::Mouse *mMouse; OIS::Keyboard *mKeyboard; OIS::InputManager* mInputManager; float mRotX, mRotY; Ogre::TextureFilterOptions mFiltering; int mAniso; bool mQuit; bool mLMBDown; bool mRMBDown; bool mProcessMovement; bool mUpdateMovement; bool mMoveFwd; bool mMoveBck; bool mMoveLeft; bool mMoveRight; CEGUI::Renderer* mGuiRenderer; CEGUI::Window* mGuiAvg; CEGUI::Window* mGuiCurr; CEGUI::Window* mGuiBest; CEGUI::Window* mGuiWorst; CEGUI::Window* mGuiTris; CEGUI::Window* mGuiDbg; CEGUI::Window* mRoot; CEGUI::MouseButton convertOgreButtonToCegui(OIS::MouseButtonID b); void CheckMovementKeys( CEGUI::Key::Scan keycode, bool state ); void updateStats(); public: UIHandler(ColladaDemo* main); virtual ~UIHandler(); virtual bool mouseMoved (const OIS::MouseEvent &e); virtual bool mouseDragged (const OIS::MouseEvent &e); virtual bool keyPressed (const OIS::KeyEvent &e); virtual bool keyReleased (const OIS::KeyEvent &e); virtual bool mousePressed (const OIS::MouseEvent &e,OIS::MouseButtonID); virtual bool mouseReleased (const OIS::MouseEvent &e,OIS::MouseButtonID); // do-nothing events virtual bool keyClicked (const OIS::KeyEvent &e) {return false;} virtual bool mouseClicked (const OIS::MouseEvent &e) {return false;} virtual bool mouseEntered (const OIS::MouseEvent &e) {return false;} virtual bool mouseExited (const OIS::MouseEvent &e) {return false;} bool frameStarted(const Ogre::FrameEvent& evt); bool handleMouseMove(const CEGUI::EventArgs& e); bool handleMouseButtonUp(const CEGUI::EventArgs& e); bool handleMouseButtonDown(const CEGUI::EventArgs& e); bool handleMouseWheelEvent(const CEGUI::EventArgs& e); bool handleKeyDownEvent(const CEGUI::EventArgs& e); bool handleKeyUpEvent(const CEGUI::EventArgs& e); }; #endif // _UIHandler_H_