Changeset 2875 for code/branches/gui/src/orxonox/gui/GUIManager.cc
- 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.cc
r2869 r2875 22 22 * Author: 23 23 * Reto Grieder 24 * Benjamin Knecht 24 25 * Co-authors: 25 * Benjamin Knecht26 * 26 27 * 27 28 */ … … 75 76 } 76 77 78 /** 79 @brief 80 Deconstructor of the GUIManager 81 82 Basically shuts down CEGUI and destroys the Lua engine and afterwards the interface to the Ogre engine. 83 */ 77 84 GUIManager::~GUIManager() 78 85 { … … 96 103 } 97 104 105 /** 106 @brief 107 Initialises the GUIManager by starting up CEGUI 108 @param renderWindow 109 Ogre's render window. Without this, the GUI cannot be displayed. 110 @return true if success, otherwise false 111 112 Before this call the GUIManager won't do anything, but can be accessed. 113 114 Creates the interface to Ogre, sets up the CEGUI renderer and the Lua script module together with the Lua engine. 115 The log is set up and connected to the CEGUILogger. 116 After Lua setup tolua++-elements are linked to Lua-state to give Lua access to C++-code. 117 Finally initial Lua code is executed (maybe we can do this with the CEGUI startup script automatically). 118 */ 98 119 bool GUIManager::initialise(Ogre::RenderWindow* renderWindow) 99 120 { … … 151 172 } 152 173 174 /** 175 @brief 176 Calls main Lua script 177 @todo 178 Replace loadGUI.lua with loadGUI_2.lua after merging this back to trunk. 179 However CEGUI is able to execute a startup script. We could maybe put this call in this startup code. 180 181 This function calls the main Lua script for our GUI. 182 183 Additionally we set the datapath variable in Lua. This is needed so Lua can access the data used for the GUI. 184 */ 153 185 void GUIManager::loadLuaCode() 154 186 { 155 187 try 156 188 { 189 // call main Lua script 157 190 this->scriptModule_->executeScriptFile("loadGUI_2.lua", "GUI"); 191 // set datapath for GUI data 158 192 lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str()); 159 193 lua_setglobal(this->scriptModule_->getLuaState(), "datapath"); … … 170 204 } 171 205 206 /** 207 @brief 208 used to tick the GUI 209 @param time 210 clock which provides time value for the GUI System 211 212 Ticking the GUI means updating it with a certain regularity. 213 The elapsed time since the last call is given in the time value provided by the clock. 214 This time value is then used to provide a fluent animation of the GUI. 215 */ 172 216 void GUIManager::update(const Clock& time) 173 217 { … … 176 220 } 177 221 222 /** 223 @brief 224 Executes Lua code 225 @param str 226 reference to string object holding the Lua code which is to be executed 227 228 This function gives total access to the GUI. You can execute ANY Lua code here. 229 */ 178 230 void GUIManager::executeCode(const std::string& str) 179 231 { … … 181 233 } 182 234 235 /** 236 @brief 237 Tells the GUIManager which SceneManager to use 238 @param camera 239 The current camera on which the GUI should be displayed on. 240 241 In fact the GUIManager needs the SceneManager and not the Camera to display the GUI. 242 This means the GUI is not bound to a camera but rather to the SceneManager. 243 Hidding the GUI when needed can therefore not be solved by just NOT setting the current camera. 244 */ 183 245 void GUIManager::setCamera(Ogre::Camera* camera) 184 246 { … … 186 248 } 187 249 250 /** 251 @brief 252 Debug function to give CEGUI the possibility to output on our console 253 @param 254 String to be displaed in CEGUI's name 255 256 This function should be removed as it only provides a quick (and dirty) possibility to access the output on the console. 257 CEGUI's output should be put into the cegui.log using the CEGUI Logger. 258 */ 188 259 void GUIManager::testOutput(std::string& str) 189 260 { … … 191 262 } 192 263 264 /** 265 @brief 266 Displays specified GUI on screen 267 @param name 268 The name of the GUI 269 270 The function executes the Lua function with the same name in case the GUIManager is ready. 271 For more details check out loadGUI_2.lua where the function presides. 272 */ 193 273 void GUIManager::showGUI(const std::string& name) 194 274 { … … 215 295 } 216 296 297 /** 298 @brief 299 Function receiving a mouse button pressed event. 300 @param id 301 ID of the mouse button which got pressed 302 303 This function is inherited by MouseHandler and injects the event into CEGUI. 304 It is for CEGUI to process the event. 305 */ 217 306 void GUIManager::mouseButtonPressed(MouseButtonCode::ByEnum id) 218 307 { … … 228 317 } 229 318 319 /** 320 @brief 321 Function receiving a mouse button released event. 322 @param id 323 ID of the mouse button which got released 324 325 This function is inherited by MouseHandler and injects the event into CEGUI. 326 It is for CEGUI to process the event. 327 */ 230 328 void GUIManager::mouseButtonReleased(MouseButtonCode::ByEnum id) 231 329 { … … 241 339 } 242 340 243 341 /** 342 @brief 343 converts mouse event code to CEGUI event code 344 @param button 345 code of the mouse button as we use it in Orxonox 346 @return 347 code of the mouse button as it is used by CEGUI 348 349 Simple convertion from mouse event code in Orxonox to the one used in CEGUI. 350 */ 244 351 inline CEGUI::MouseButton GUIManager::convertButton(MouseButtonCode::ByEnum button) 245 352 {
Note: See TracChangeset
for help on using the changeset viewer.