Changeset 2875 for code/branches/gui/src/orxonox/gui/GUIManager.h
- Timestamp:
- Mar 31, 2009, 2:14:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gui/GUIManager.h
r2853 r2875 23 23 * Reto Grieder 24 24 * Co-authors: 25 * ...25 * Benjamin Knecht 26 26 * 27 27 */ … … 49 49 { 50 50 /** 51 @class GUIManager 51 52 @brief 52 Provides a simple interface to CEGUI with tolua methods and console commands 53 Provides a simple interface to CEGUI with tolua methods and console commands. It also acts as a key and mouse handler. 54 55 The GUIManager is a singleton and can be called anywhere when access on the GUI is needed. 56 Creation of the GUIManager is therefore not possible and the cunstructor is private. 57 58 Since the GUI needs user input, the GUIManager implements the functions needed to act as a key and/or mouse handler. 59 Those input events are then injected into CEGUI in Lua. 53 60 */ 54 61 class _OrxonoxExport GUIManager … … 59 66 // tolua_end 60 67 public: 68 /** 69 @enum State 70 The current state of the GUIManager. There should maybe be more (or we can omit this totally). 71 */ 61 72 enum State 62 73 { 63 Uninitialised, 64 Ready, 65 OnDisplay 74 Uninitialised, //!< Initial state of the GUIManager 75 Ready, //!< State after initialisation if ready 76 OnDisplay //!< State if GUI is displayed 66 77 }; 67 78 … … 84 95 85 96 private: 86 GUIManager(const GUIManager& instance); 97 GUIManager(const GUIManager& instance); //!< private constructor (this is a singleton class) 87 98 88 99 void loadLuaCode(); 89 100 101 // keyHandler functions 90 102 void keyPressed (const KeyEvent& evt) 91 { guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text); }103 { guiSystem_->injectKeyDown(evt.key); guiSystem_->injectChar(evt.text); } 92 104 void keyReleased(const KeyEvent& evt) 93 { guiSystem_->injectKeyUp(evt.key); } 94 void keyHeld (const KeyEvent& evt) 95 { } 105 { guiSystem_->injectKeyUp(evt.key); } 106 void keyHeld (const KeyEvent& evt) { } 96 107 108 // mouseHandler functions 97 109 void mouseButtonPressed (MouseButtonCode::ByEnum id); 98 110 void mouseButtonReleased(MouseButtonCode::ByEnum id); 99 void mouseButtonHeld (MouseButtonCode::ByEnum id) 100 { } 111 void mouseButtonHeld (MouseButtonCode::ByEnum id) { } 101 112 void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) 102 { guiSystem_->injectMouseMove(rel.x, rel.y); }113 { guiSystem_->injectMouseMove(rel.x, rel.y); } 103 114 void mouseScrolled (int abs, int rel) 104 { guiSystem_->injectMouseWheelChange(rel);}115 { guiSystem_->injectMouseWheelChange(rel);} 105 116 106 void updateInput(float dt) { } 107 void updateKey(float dt) { } 108 void updateMouse(float dt) { } 109 110 Ogre::RenderWindow* renderWindow_; 111 CEGUI::OgreCEGUIRenderer* guiRenderer_; 112 CEGUI::ResourceProvider* resourceProvider_; 113 CEGUI::LuaScriptModule* scriptModule_; 114 CEGUI::DefaultLogger* ceguiLogger_; 115 CEGUI::System* guiSystem_; 116 CEGUI::Imageset* backgroundImage_; 117 lua_State* luaState_; 118 119 State state_; 117 void updateInput(float dt) { } 118 void updateKey (float dt) { } 119 void updateMouse(float dt) { } 120 120 121 121 static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button); 122 122 123 static GUIManager* singletonRef_s; 123 Ogre::RenderWindow* renderWindow_; //!< Ogre's render window to give CEGUI access to it 124 CEGUI::OgreCEGUIRenderer* guiRenderer_; //!< CEGUI's interface to the Ogre Engine 125 CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider 126 CEGUI::LuaScriptModule* scriptModule_; //!< CEGUI's script module to use Lua 127 CEGUI::DefaultLogger* ceguiLogger_; //!< CEGUI's logger to be able to log CEGUI errors in our log 128 CEGUI::System* guiSystem_; //!< CEGUI's main system 129 lua_State* luaState_; //!< Lua state, access point to the Lua engine 130 131 State state_; //!< reflects state of the GUIManager 132 133 static GUIManager* singletonRef_s; //!< Singleton reference to GUIManager 124 134 }; // tolua_export 125 135 } // tolua_export
Note: See TracChangeset
for help on using the changeset viewer.