Changeset 1653 for code/branches/gui
- Timestamp:
- Aug 5, 2008, 9:50:26 PM (16 years ago)
- Location:
- code/branches/gui/src
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/input/ExtendedInputState.cc
r1642 r1653 37 37 #include <assert.h> 38 38 #include "core/Debug.h" 39 #include "core/CoreIncludes.h"40 39 41 40 namespace orxonox 42 41 { 43 CreateFactory(ExtendedInputState);44 45 42 using namespace InputDevice; 46 47 ExtendedInputState::ExtendedInputState()48 {49 RegisterObject(ExtendedInputState);50 }51 43 52 44 void ExtendedInputState::numberOfJoySticksChanged(unsigned int n) -
code/branches/gui/src/core/input/ExtendedInputState.h
r1646 r1653 48 48 { 49 49 friend class InputManager; 50 friend class ClassFactory<ExtendedInputState>;51 50 52 51 public: … … 68 67 69 68 private: 70 ExtendedInputState() ;69 ExtendedInputState() { } 71 70 ~ExtendedInputState() { } 72 71 -
code/branches/gui/src/core/input/InputManager.cc
r1646 r1653 161 161 setConfigValues(); 162 162 163 stateEmpty_ = create SimpleInputState("empty", -1);163 stateEmpty_ = createInputState<SimpleInputState>("empty", -1); 164 164 stateEmpty_->setHandler(new EmptyHandler()); 165 165 activeStates_[stateEmpty_->getPriority()] = stateEmpty_; 166 166 167 stateDetector_ = create SimpleInputState("detector", 101);167 stateDetector_ = createInputState<SimpleInputState>("detector", 101); 168 168 KeyDetector* temp = new KeyDetector(); 169 169 temp->loadBindings("storeKeyStroke"); 170 170 stateDetector_->setHandler(temp); 171 171 172 stateCalibrator_ = create SimpleInputState("calibrator", 100);172 stateCalibrator_ = createInputState<SimpleInputState>("calibrator", 100); 173 173 stateCalibrator_->setHandler(new EmptyHandler()); 174 174 InputBuffer* buffer = new InputBuffer(); … … 1037 1037 /** 1038 1038 @brief 1039 Returns a new SimpleInputState and configures it first.1040 */1041 SimpleInputState* InputManager::createSimpleInputState(const std::string &name, int priority)1042 {1043 SimpleInputState* state = new SimpleInputState();1044 if (_configureInputState(state, name, priority))1045 return state;1046 else1047 {1048 delete state;1049 return 0;1050 }1051 }1052 1053 /**1054 @brief1055 Returns a new ExtendedInputState and configures it first.1056 */1057 ExtendedInputState* InputManager::createExtendedInputState(const std::string &name, int priority)1058 {1059 ExtendedInputState* state = new ExtendedInputState();1060 if (_configureInputState(state, name, priority))1061 return state;1062 else1063 {1064 delete state;1065 return 0;1066 }1067 }1068 1069 /**1070 @brief1071 Returns a new InputState of type 'type' and configures it first.1072 @param type1073 String name of the class (used by the factory)1074 */1075 InputState* InputManager::createInputState(const std::string& type, const std::string &name, int priority)1076 {1077 InputState* state = dynamic_cast<InputState*>(Factory::getIdentifier(type)->fabricate());1078 if (_configureInputState(state, name, priority))1079 return state;1080 else1081 {1082 delete state;1083 return 0;1084 }1085 }1086 1087 /**1088 @brief1089 1039 Removes an input state internally. 1090 1040 @param name -
code/branches/gui/src/core/input/InputManager.h
r1645 r1653 102 102 void setWindowExtents(const int width, const int height); 103 103 104 SimpleInputState* createSimpleInputState (const std::string& name, int priority); 105 ExtendedInputState* createExtendedInputState(const std::string& name, int priority); 106 InputState* createInputState(const std::string& type, const std::string &name, int priority); 104 template <class T> 105 T* createInputState(const std::string& name, int priority) 106 { 107 T* state = new T; 108 if (_configureInputState(state, name, priority)) 109 return state; 110 else 111 { 112 delete state; 113 return 0; 114 } 115 } 116 107 117 bool destroyState (const std::string& name); 108 118 InputState* getState (const std::string& name); -
code/branches/gui/src/core/input/InputState.h
r1646 r1653 40 40 #include <vector> 41 41 #include "core/Executor.h" 42 #include "core/BaseObject.h"43 #include "core/CoreIncludes.h"44 42 #include "InputInterfaces.h" 45 43 46 44 namespace orxonox 47 45 { 48 class _CoreExport InputState : public BaseObject46 class _CoreExport InputState 49 47 { 50 48 friend class InputManager; … … 89 87 90 88 protected: 91 InputState() : priority_(0), executorOnEnter_(0), executorOnLeave_(0) 92 { RegisterObject(InputState); } 89 InputState() : priority_(0), executorOnEnter_(0), executorOnLeave_(0) { } 93 90 virtual ~InputState() { } 94 91 -
code/branches/gui/src/core/input/KeyDetector.cc
r1638 r1653 68 68 void KeyDetector::loadBindings(const std::string& command) 69 69 { 70 this->command_ = command; 70 71 clearBindings(); 71 72 setConfigValues(); 72 this->command_ = command;73 73 } 74 74 -
code/branches/gui/src/core/input/SimpleInputState.cc
r1642 r1653 38 38 #include "core/Debug.h" 39 39 #include "core/Executor.h" 40 #include "core/CoreIncludes.h"41 40 42 41 namespace orxonox 43 42 { 44 CreateFactory(SimpleInputState);45 46 43 using namespace InputDevice; 47 44 … … 51 48 , joyStickHandlerAll_(0) 52 49 { 53 RegisterObject(SimpleInputState);54 50 } 55 51 -
code/branches/gui/src/core/input/SimpleInputState.h
r1646 r1653 46 46 { 47 47 friend class InputManager; 48 friend class ClassFactory<SimpleInputState>;49 48 50 49 public: -
code/branches/gui/src/orxonox/GraphicsEngine.cc
r1652 r1653 64 64 namespace orxonox 65 65 { 66 SetConsoleCommand(GraphicsEngine, printScreen, true).setKeybindMode(KeybindMode::OnPress); 67 66 68 GraphicsEngine* GraphicsEngine::singletonRef_s = 0; 67 69 … … 72 74 The only instance of GraphicsEngine. 73 75 */ 74 /*static*/ GraphicsEngine& GraphicsEngine::get Singleton()76 /*static*/ GraphicsEngine& GraphicsEngine::getInstance() 75 77 { 76 78 assert(singletonRef_s); … … 128 130 if (this->root_) 129 131 delete this->root_; 130 this->root_ = 0;131 this->levelSceneManager_ = 0;132 this->renderWindow_ = 0;133 132 134 133 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 … … 154 153 CCOUT(3) << "Setting up..." << std::endl; 155 154 156 // TODO: LogManager doesn't work on linuxplatform. The why is yet unknown.155 // TODO: LogManager doesn't work on oli platform. The why is yet unknown. 157 156 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 158 157 // create a new logManager … … 193 192 root_ = new Ogre::Root(ogrePluginsFile_, ogreConfigFile_, ogreLogFile_); 194 193 195 if (!root_->getInstalledPlugins().size()) 196 { 197 ThrowException(PluginsNotFound, "No Ogre plugins declared. Cannot load Ogre."); 198 } 199 200 #if 0 // Ogre 1.4.3 doesn't support setDebugOutputEnabled(.) 201 //#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32 194 // We don't need plugins for the dedicated.. 195 //if (!root_->getInstalledPlugins().size() > 0) 196 //{ 197 // ThrowException(PluginsNotFound, "No Ogre plugins declared. Cannot load Ogre."); 198 //} 199 200 #if 0 // Ogre 1.4.3 doesn't yet support setDebugOutputEnabled(.) 201 #if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32 202 202 // tame the ogre ouput so we don't get all the mess in the console 203 203 Ogre::Log* defaultLog = Ogre::LogManager::getSingleton().getDefaultLog(); … … 206 206 defaultLog->addListener(this); 207 207 #endif 208 #endif 208 209 209 210 CCOUT(4) << "Creating Ogre Root done" << std::endl; … … 233 234 cf.load(Settings::getDataPath() + resourceFile_); 234 235 } 235 catch ( Ogre::Exception& ex)236 { 237 COUT(1) << ex.getFullDescription() << std::endl;236 catch (...) 237 { 238 //COUT(1) << ex.getFullDescription() << std::endl; 238 239 COUT(0) << "Have you forgotten to set the data path in orxnox.ini?" << std::endl; 239 240 throw; … … 300 301 } 301 302 302 boolGraphicsEngine::initialiseResources()303 void GraphicsEngine::initialiseResources() 303 304 { 304 305 CCOUT(4) << "Initialising resources" << std::endl; … … 313 314 }*/ 314 315 } 315 catch (Ogre::Exception& e) 316 { 317 CCOUT(2) << "Error: There was an Error when initialising the resources." << std::endl; 318 CCOUT(2) << "ErrorMessage: " << e.getFullDescription() << std::endl; 319 return false; 320 } 321 return true; 316 catch (...) 317 { 318 CCOUT(2) << "Error: There was a serious error when initialising the resources." << std::endl; 319 throw; 320 } 322 321 } 323 322 … … 326 325 Creates the SceneManager 327 326 */ 328 boolGraphicsEngine::createNewScene()327 void GraphicsEngine::createNewScene() 329 328 { 330 329 CCOUT(4) << "Creating new SceneManager..." << std::endl; … … 332 331 { 333 332 CCOUT(2) << "SceneManager already exists! Skipping." << std::endl; 334 return false;335 333 } 336 334 this->levelSceneManager_ = this->root_->createSceneManager(Ogre::ST_GENERIC, "LevelSceneManager"); 337 CCOUT(3) << "Created SceneManager: " << levelSceneManager_ << std::endl; 338 return true; 335 CCOUT(3) << "Created SceneManager: " << levelSceneManager_->getName() << std::endl; 339 336 } 340 337 … … 487 484 } 488 485 486 487 /*static*/ void GraphicsEngine::printScreen() 488 { 489 if (getInstance().renderWindow_) 490 { 491 getInstance().renderWindow_->writeContentsToTimestampedFile("shot_", ".jpg"); 492 } 493 } 489 494 } -
code/branches/gui/src/orxonox/GraphicsEngine.h
r1652 r1653 62 62 void declareRessourceLocations(); 63 63 void loadRenderer(); 64 boolinitialiseResources();65 boolcreateNewScene();64 void initialiseResources(); 65 void createNewScene(); 66 66 67 67 void setLevelSceneManager(Ogre::SceneManager* sceneMgr) { this->levelSceneManager_ = sceneMgr; } … … 87 87 { return this->detailLevelParticle_; } 88 88 89 static GraphicsEngine& getSingleton(); 90 static GraphicsEngine* getSingletonPtr() { return singletonRef_s; } 89 // console commands 90 static void printScreen(); 91 92 static GraphicsEngine& getInstance(); 93 static GraphicsEngine* getInstancePtr() { return singletonRef_s; } 91 94 92 95 private: -
code/branches/gui/src/orxonox/Orxonox.cc
r1646 r1653 112 112 , mode_(GameMode::GM_Unspecified) 113 113 , debugRefreshTime_(0.0f) 114 , ogre_(0)114 , graphicsEngine_(0) 115 115 , inputManager_(0) 116 116 , radar_(0) … … 157 157 delete inputManager_; 158 158 159 if (this-> ogre_)160 delete ogre_;159 if (this->graphicsEngine_) 160 delete graphicsEngine_; 161 161 162 162 if (network::Client::getSingleton()) … … 212 212 } 213 213 214 215 /** 216 * Starts the whole Game. 217 * @param path path to config (in home dir or something) 218 */ 219 void Orxonox::start() 220 { 221 #ifdef _DEBUG 222 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox_d.ini"); 214 /** 215 @brief 216 Starts the whole Game. 217 @param path 218 path to config (in home dir or something) 219 */ 220 void Orxonox::start() 221 { 222 #if ORXONOX_DEBUG_MODE == 1 223 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox_d.ini"); 223 224 #else 224 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");225 ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini"); 225 226 #endif 226 Factory::createClassHierarchy(); 227 228 setConfigValues(); 229 230 const Settings::CommandLineArgument* mode = Settings::getCommandLineArgument("mode"); 231 assert(mode); 232 if (!mode->bHasDefaultValue_) 227 228 // creates the class hierarchy for all classes with factories 229 Factory::createClassHierarchy(); 230 231 setConfigValues(); 232 233 const Settings::CommandLineArgument* mode = Settings::getCommandLineArgument("mode"); 234 assert(mode); 235 if (!mode->bHasDefaultValue_) 236 { 237 Settings::setGameMode(mode->value_); 238 this->mode_ = Settings::getGameMode(); 239 } 240 COUT(3) << "Orxonox: Game mode is " << mode_.name << "." << std::endl; 241 242 const Settings::CommandLineArgument* dataPath = Settings::getCommandLineArgument("dataPath"); 243 assert(dataPath); 244 if (!dataPath->bHasDefaultValue_) 245 { 246 if (*dataPath->value_.getString().end() != '/' && *dataPath->value_.getString().end() != '\\') 247 Settings::tsetDataPath(dataPath->value_.getString() + "/"); 248 else 249 Settings::tsetDataPath(dataPath->value_.getString()); 250 } 251 252 try 253 { 254 // initialise TCL 255 TclBind::getInstance().setDataPath(Settings::getDataPath()); 256 257 graphicsEngine_ = new GraphicsEngine(); 258 graphicsEngine_->setup(); // creates ogre root and other essentials 259 260 if (mode_.showsGraphics) 261 { 262 graphicsEngine_->loadRenderer(); // creates the render window 263 264 // TODO: Spread this so that this call only initialises things needed for the Console and GUI 265 graphicsEngine_->initialiseResources(); 266 267 // Calls the InputManager which sets up the input devices. 268 // The render window width and height are used to set up the mouse movement. 269 inputManager_ = new InputManager(); 270 inputManager_->initialise(graphicsEngine_->getWindowHandle(), 271 graphicsEngine_->getWindowWidth(), graphicsEngine_->getWindowHeight(), true, true, true); 272 KeyBinder* keyBinder = new KeyBinder(); 273 keyBinder->loadBindings(); 274 inputManager_->createInputState<SimpleInputState>("game", 20)->setHandler(keyBinder); 275 276 // Load the InGameConsole 277 console_ = new InGameConsole(); 278 console_->initialise(); 279 280 // load the CEGUI interface 281 guiManager_ = new GUIManager(); 282 guiManager_->initialise(); 283 } 284 else 285 { 286 // TODO: Initialise a not yet written console that operates in the shell we 287 // started the game from. 288 // We probably want to use std::cin to catch input (OIS uses DirectX or X server) 289 } 290 291 bool showGUI = true; 292 if (mode_.mode != GameMode::Unspecified) 293 { 294 showGUI = false; 295 // a game mode was specified with the command line 296 // we therefore load the game and level directly 297 298 if (!loadLevel(this->mode_)) 299 { 300 COUT(1) << "Loading with predefined mode failed. Showing main menu." << std::endl; 301 showGUI = true; 302 mode_ = GameMode::GM_Unspecified; 303 } 304 } 305 306 if (showGUI) 307 { 308 // show main menu 309 GUIManager::getInstance().showGUI("MainMenu", 0); 310 GraphicsEngine::getInstance().getViewport()->setCamera(GUIManager::getInstance().getCamera()); 311 } 312 } 313 catch (std::exception& ex) 314 { 315 COUT(1) << ex.what() << std::endl; 316 COUT(1) << "Loading sequence aborted." << std::endl; 317 return; 318 } 319 320 modeRequest_ = mode_; 321 // here happens the game 322 startRenderLoop(); 323 324 if (mode_.mode == GameMode::Client) 325 network::Client::getSingleton()->closeConnection(); 326 327 if (mode_.hasServer) 328 server_g->close(); 329 } 330 331 /*static*/ void Orxonox::loadGame(const std::string& name) 233 332 { 234 Settings::setGameMode(mode->value_); 235 this->mode_ = Settings::getGameMode(); 333 const GameMode& mode = Settings::getGameMode(name); 334 if (mode.mode == GameMode::None) 335 return; 336 337 getSingleton().modeRequest_ = mode; 236 338 } 237 COUT(3) << "Orxonox: Game mode is " << mode_.name << "." << std::endl; 238 239 const Settings::CommandLineArgument* dataPath = Settings::getCommandLineArgument("dataPath"); 240 assert(dataPath); 241 if (!dataPath->bHasDefaultValue_) 339 340 bool Orxonox::loadLevel(const GameMode& mode) 242 341 { 243 if (*dataPath->value_.getString().end() != '/' && *dataPath->value_.getString().end() != '\\') 244 Settings::tsetDataPath(dataPath->value_.getString() + "/"); 245 else 246 Settings::tsetDataPath(dataPath->value_.getString()); 342 bool success = true; 343 344 if (mode.showsGraphics) 345 { 346 // create Ogre SceneManager for the level 347 graphicsEngine_->createNewScene(); 348 349 if (!loadPlayground()) 350 return false; 351 } 352 353 switch (mode.mode) 354 { 355 case GameMode::Server: 356 success &= serverLoad(); 357 break; 358 case GameMode::Client: 359 success &= clientLoad(); 360 break; 361 case GameMode::Dedicated: 362 success &= serverLoad(); 363 break; 364 case GameMode::Standalone: 365 success &= standaloneLoad(); 366 break; 367 default: // never happens 368 assert(false); 369 } 370 371 if (success) 372 { 373 InputManager::getInstance().requestEnterState("game"); 374 this->mode_ = mode; 375 } 376 377 return success; 247 378 } 248 249 try250 {251 // initialise TCL252 TclBind::getInstance().setDataPath(Settings::getDataPath());253 254 ogre_ = new GraphicsEngine();255 ogre_->setup(); // creates ogre root and other essentials256 257 if (mode_.showsGraphics)258 {259 ogre_->loadRenderer(); // creates the render window260 261 // TODO: Spread this so that this call only initialises things needed for the Console and GUI262 ogre_->initialiseResources();263 264 // Calls the InputManager which sets up the input devices.265 // The render window width and height are used to set up the mouse movement.266 inputManager_ = new InputManager();267 inputManager_->initialise(ogre_->getWindowHandle(),268 ogre_->getWindowWidth(), ogre_->getWindowHeight(), true, true, true);269 KeyBinder* keyBinder = new KeyBinder();270 keyBinder->loadBindings();271 inputManager_->createSimpleInputState("game", 20)->setHandler(keyBinder);272 273 // Load the InGameConsole274 console_ = new InGameConsole();275 console_->initialise();276 277 // load the CEGUI interface278 guiManager_ = new GUIManager();279 guiManager_->initialise();280 }281 282 bool showGUI = true;283 if (mode_.mode != GameMode::Unspecified)284 {285 showGUI = false;286 // a game mode was specified with the command line287 // we therefore load the game and level directly288 289 if (!loadLevel(this->mode_))290 {291 COUT(1) << "Loading with predefined mode failed. Showing main menu." << std::endl;292 showGUI = true;293 mode_ = GameMode::GM_Unspecified;294 }295 }296 297 if (showGUI)298 {299 // show main menu300 GUIManager::getInstance().showGUI("MainMenu", 0);301 GraphicsEngine::getSingleton().getViewport()->setCamera(GUIManager::getInstance().getCamera());302 }303 }304 catch (std::exception& ex)305 {306 COUT(1) << ex.what() << std::endl;307 COUT(1) << "Loading sequence aborted." << std::endl;308 return;309 }310 311 modeRequest_ = mode_;312 // here happens the game313 startRenderLoop();314 315 if (mode_.mode == GameMode::Client)316 network::Client::getSingleton()->closeConnection();317 318 if (mode_.hasServer)319 server_g->close();320 }321 322 /*static*/ void Orxonox::loadGame(const std::string& name)323 {324 const GameMode& mode = Settings::getGameMode(name);325 if (mode.mode == GameMode::None)326 return;327 328 getSingleton().modeRequest_ = mode;329 }330 331 bool Orxonox::loadLevel(const GameMode& mode)332 {333 bool success = true;334 335 if (mode.showsGraphics)336 {337 // create Ogre SceneManager for the level338 ogre_->createNewScene();339 340 if (!loadPlayground())341 return false;342 }343 344 switch (mode.mode)345 {346 case GameMode::Server:347 success &= serverLoad();348 break;349 case GameMode::Client:350 success &= clientLoad();351 break;352 case GameMode::Dedicated:353 success &= serverLoad();354 break;355 case GameMode::Standalone:356 success &= standaloneLoad();357 break;358 default: // never happens359 assert(false);360 }361 362 if (success)363 {364 InputManager::getInstance().requestEnterState("game");365 this->mode_ = mode;366 }367 368 return success;369 }370 379 371 380 /** … … 528 537 if (timeAfterTick > refreshStartTime + refreshTime) 529 538 { 530 GraphicsEngine::get Singleton().setAverageTickTime(539 GraphicsEngine::getInstance().setAverageTickTime( 531 540 (float)tickTime * 0.001 / (frameCount - oldFrameCount)); 532 541 float avgFPS = (float)(frameCount - oldFrameCount) / (timeAfterTick - refreshStartTime) * 1000000.0; 533 GraphicsEngine::get Singleton().setAverageFramesPerSecond(avgFPS);542 GraphicsEngine::getInstance().setAverageFramesPerSecond(avgFPS); 534 543 535 544 oldFrameCount = frameCount; … … 552 561 // make sure the window stays active even when not focused 553 562 // (probably only necessary on windows) 554 GraphicsEngine::get Singleton().setWindowActivity(true);563 GraphicsEngine::getInstance().setWindowActivity(true); 555 564 556 565 // tick CEGUI -
code/branches/gui/src/orxonox/Orxonox.h
r1646 r1653 84 84 85 85 private: 86 Level* startLevel_; //!< current hard coded default level87 Level* hud_; //!< 'level' object fo the HUD88 //audio::AudioManager* auMan_; //!< audio manager89 Ogre::Timer* timer_; //!< Main loop timer90 bool bAbort_; //!< aborts the render loop if true91 float timefactor_; //!< A factor to change the gamespeed86 Level* startLevel_; //!< current hard coded default level 87 Level* hud_; //!< 'level' object fo the HUD 88 //audio::AudioManager* auMan_; //!< audio manager 89 Ogre::Timer* timer_; //!< Main loop timer 90 bool bAbort_; //!< aborts the render loop if true 91 float timefactor_; //!< A factor to change the gamespeed 92 92 93 93 // this is used to identify the mode (server/client/...) we're in … … 99 99 100 100 // By Orxonox managed singleton pointers 101 GraphicsEngine* ogre_;//!< our dearest graphics engine <3101 GraphicsEngine* graphicsEngine_; //!< our dearest graphics engine <3 102 102 InputManager* inputManager_; 103 Radar* radar_; //!< represents the Radar (not the HUD part)103 Radar* radar_; //!< represents the Radar (not the HUD part) 104 104 InGameConsole* console_; 105 105 GUIManager* guiManager_; -
code/branches/gui/src/orxonox/OrxonoxPrereqs.h
r1646 r1653 84 84 class Backlight; 85 85 class Camera; 86 class Fighter;87 86 class Model; 88 87 class NPC; … … 131 130 } 132 131 132 namespace CEGUI 133 { 134 class LuaScriptModule; 135 136 class OgreCEGUIRenderer; 137 class OgreCEGUIResourceProvider; 138 class OgreCEGUITexture; 139 } 140 141 struct lua_State; 142 133 143 #endif /* _OrxonoxPrereqs_H__ */ -
code/branches/gui/src/orxonox/gui/GUIManager.cc
r1646 r1653 29 29 /** 30 30 @file 31 @brief Implementation of the GUIManager class. 31 @brief 32 Implementation of the GUIManager class. 32 33 */ 33 34 … … 120 121 { 121 122 // get the render window 122 renderWindow_ = GraphicsEngine::get Singleton().getRenderWindow();123 renderWindow_ = GraphicsEngine::getInstance().getRenderWindow(); 123 124 124 125 // Full screen viewport with Z order = 0 (top most). Don't yet feed a camera (so nothing gets rendered) … … 150 151 151 152 // register us as input handler 152 SimpleInputState* state = InputManager::getInstance().create SimpleInputState("gui", 30);153 SimpleInputState* state = InputManager::getInstance().createInputState<SimpleInputState>("gui", 30); 153 154 state->setHandler(this); 154 155 state->setJoyStickHandler(new EmptyHandler()); … … 159 160 catch (CEGUI::Exception& ex) 160 161 { 161 #if CEGUI_VERSION_M INOR < 6162 #if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6 162 163 throw GeneralException(ex.getMessage().c_str()); 163 164 #else -
code/branches/gui/src/orxonox/gui/GUIManager.h
r1647 r1653 41 41 #include <CEGUISystem.h> 42 42 #include "core/input/InputInterfaces.h" 43 44 // forward declarations45 namespace CEGUI46 {47 class OgreCEGUIRenderer;48 class LuaScriptModule;49 }50 struct lua_State;51 43 52 44 namespace orxonox // tolua_export -
code/branches/gui/src/orxonox/objects/Ambient.cc
r1638 r1653 65 65 66 66 bool Ambient::create(){ 67 GraphicsEngine::get Singleton().getLevelSceneManager()->setAmbientLight(ambientLight_);67 GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(ambientLight_); 68 68 return Synchronisable::create(); 69 69 } … … 76 76 void Ambient::setAmbientLight(const ColourValue& colour) 77 77 { 78 GraphicsEngine::get Singleton().getLevelSceneManager()->setAmbientLight(colour);78 GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(colour); 79 79 ambientLight_=colour; 80 80 } -
code/branches/gui/src/orxonox/objects/Backlight.cc
r1638 r1653 58 58 this->attachObject(this->billboard_.getBillboardSet()); 59 59 60 this->ribbonTrail_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createRibbonTrail(this->getName() + "RibbonTrail");61 this->ribbonTrailNode_ = GraphicsEngine::get Singleton().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName() + "RibbonTrailNode");60 this->ribbonTrail_ = GraphicsEngine::getInstance().getLevelSceneManager()->createRibbonTrail(this->getName() + "RibbonTrail"); 61 this->ribbonTrailNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName() + "RibbonTrailNode"); 62 62 this->ribbonTrailNode_->attachObject(this->ribbonTrail_); 63 63 this->ribbonTrail_->addNode(this->getNode()); … … 76 76 { 77 77 this->detachObject(this->billboard_.getBillboardSet()); 78 GraphicsEngine::get Singleton().getLevelSceneManager()->destroySceneNode(this->getName() + "RibbonTrailNode");79 GraphicsEngine::get Singleton().getLevelSceneManager()->destroyRibbonTrail(this->ribbonTrail_);78 GraphicsEngine::getInstance().getLevelSceneManager()->destroySceneNode(this->getName() + "RibbonTrailNode"); 79 GraphicsEngine::getInstance().getLevelSceneManager()->destroyRibbonTrail(this->ribbonTrail_); 80 80 } 81 81 } -
code/branches/gui/src/orxonox/objects/Camera.cc
r1638 r1653 52 52 { 53 53 this->bHasFocus_ = false; 54 this->cameraNode_ = GraphicsEngine::get Singleton().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(node->getName() + "Camera");54 this->cameraNode_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(node->getName() + "Camera"); 55 55 if( node != NULL ) 56 56 this->setPositionNode(node); … … 60 60 { 61 61 CameraHandler::getInstance()->releaseFocus(this); 62 GraphicsEngine::get Singleton().getLevelSceneManager()->getRootSceneNode()->removeAndDestroyChild(cameraNode_->getName());62 GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->removeAndDestroyChild(cameraNode_->getName()); 63 63 } 64 64 -
code/branches/gui/src/orxonox/objects/CameraHandler.cc
r1640 r1653 44 44 CameraHandler::CameraHandler() 45 45 { 46 this->cam_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createCamera("Cam");47 GraphicsEngine::get Singleton().getViewport()->setCamera(this->cam_);48 //GraphicsEngine::get Singleton().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2);46 this->cam_ = GraphicsEngine::getInstance().getLevelSceneManager()->createCamera("Cam"); 47 GraphicsEngine::getInstance().getViewport()->setCamera(this->cam_); 48 //GraphicsEngine::getInstance().getRenderWindow()->addViewport(this->cam_, 2, 0.4, 0.4, 0.2, 0.2); 49 49 /*this->activeCamera_ = *ObjectList<Camera>::begin(); 50 50 this->activeCamera_->cam_ = this->cam_;*/ -
code/branches/gui/src/orxonox/objects/ParticleSpawner.cc
r1638 r1653 79 79 this->setPosition(this->getNode()->getParent()->getPosition()); 80 80 this->getNode()->getParent()->removeChild(this->getNode()); 81 GraphicsEngine::get Singleton().getLevelSceneManager()->getRootSceneNode()->addChild(this->getNode());81 GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->addChild(this->getNode()); 82 82 if (this->particle_) 83 83 this->particle_->setEnabled(false); -
code/branches/gui/src/orxonox/objects/Skybox.cc
r1638 r1653 56 56 void Skybox::setSkybox(const std::string& skyboxname) 57 57 { 58 GraphicsEngine::get Singleton().getLevelSceneManager()->setSkyBox(true, skyboxname);58 GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(true, skyboxname); 59 59 } 60 60 … … 92 92 { 93 93 BaseObject::changedVisibility(); 94 GraphicsEngine::get Singleton().getLevelSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_);94 GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_); 95 95 } 96 96 } -
code/branches/gui/src/orxonox/objects/WorldEntity.cc
r1638 r1653 49 49 RegisterObject(WorldEntity); 50 50 51 if (GraphicsEngine::get Singleton().getLevelSceneManager())51 if (GraphicsEngine::getInstance().getLevelSceneManager()) 52 52 { 53 53 std::ostringstream name; 54 54 name << (WorldEntity::worldEntityCounter_s++); 55 55 this->setName("WorldEntity" + name.str()); 56 this->node_ = GraphicsEngine::get Singleton().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());56 this->node_ = GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName()); 57 57 58 58 registerAllVariables(); … … 77 77 { 78 78 this->getNode()->removeAndDestroyAllChildren(); 79 GraphicsEngine::get Singleton().getLevelSceneManager()->destroySceneNode(this->getName());79 GraphicsEngine::getInstance().getLevelSceneManager()->destroySceneNode(this->getName()); 80 80 } 81 81 } … … 178 178 void WorldEntity::attachObject(const WorldEntity& obj) const 179 179 { 180 GraphicsEngine::get Singleton().getLevelSceneManager()->getRootSceneNode()->removeChild(obj.getNode());180 GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->removeChild(obj.getNode()); 181 181 this->getNode()->addChild(obj.getNode()); 182 182 } … … 184 184 void WorldEntity::attachObject(WorldEntity* obj) const 185 185 { 186 GraphicsEngine::get Singleton().getLevelSceneManager()->getRootSceneNode()->removeChild(obj->getNode());186 GraphicsEngine::getInstance().getLevelSceneManager()->getRootSceneNode()->removeChild(obj->getNode()); 187 187 this->getNode()->addChild(obj->getNode()); 188 188 } -
code/branches/gui/src/orxonox/overlays/OrxonoxOverlay.cc
r1633 r1653 115 115 // We'll have to get the aspect ratio manually for the first time. Afterwards windowResized() gets 116 116 // called automatically by the GraphicsEngine. 117 this->windowResized(GraphicsEngine::get Singleton().getWindowWidth(),118 GraphicsEngine::get Singleton().getWindowHeight());117 this->windowResized(GraphicsEngine::getInstance().getWindowWidth(), 118 GraphicsEngine::getInstance().getWindowHeight()); 119 119 120 120 this->changedVisibility(); -
code/branches/gui/src/orxonox/overlays/console/InGameConsole.cc
r1642 r1653 147 147 { 148 148 // create the corresponding input state 149 InputManager::getInstance().create SimpleInputState("console", 40)149 InputManager::getInstance().createInputState<SimpleInputState>("console", 40) 150 150 ->setKeyHandler(Shell::getInstance().getInputBuffer()); 151 151 … … 219 219 this->consoleOverlayContainer_->addChild(this->consoleOverlayNoise_); 220 220 221 this->windowResized(GraphicsEngine::get Singleton().getWindowWidth(), GraphicsEngine::getSingleton().getWindowHeight());221 this->windowResized(GraphicsEngine::getInstance().getWindowWidth(), GraphicsEngine::getInstance().getWindowHeight()); 222 222 223 223 // move overlay "above" the top edge of the screen -
code/branches/gui/src/orxonox/overlays/debug/DebugFPSText.cc
r1625 r1653 49 49 void DebugFPSText::tick(float dt) 50 50 { 51 float fps = GraphicsEngine::get Singleton().getAverageFramesPerSecond();51 float fps = GraphicsEngine::getInstance().getAverageFramesPerSecond(); 52 52 this->text_->setCaption(this->getCaption() + convertToString(fps)); 53 53 } -
code/branches/gui/src/orxonox/overlays/debug/DebugRTRText.cc
r1625 r1653 49 49 void DebugRTRText::tick(float dt) 50 50 { 51 float rtr = GraphicsEngine::get Singleton().getAverageTickTime();51 float rtr = GraphicsEngine::getInstance().getAverageTickTime(); 52 52 this->text_->setCaption(this->getCaption() + convertToString(rtr)); 53 53 } -
code/branches/gui/src/orxonox/tools/BillboardSet.cc
r1638 r1653 50 50 std::ostringstream name; 51 51 name << (BillboardSet::billboardSetCounter_s++); 52 this->billboardSet_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);52 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count); 53 53 this->billboardSet_->createBillboard(Vector3::ZERO); 54 54 this->billboardSet_->setMaterialName(file); … … 59 59 std::ostringstream name; 60 60 name << (BillboardSet::billboardSetCounter_s++); 61 this->billboardSet_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);61 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count); 62 62 this->billboardSet_->createBillboard(Vector3::ZERO, colour); 63 63 this->billboardSet_->setMaterialName(file); … … 68 68 std::ostringstream name; 69 69 name << (BillboardSet::billboardSetCounter_s++); 70 this->billboardSet_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);70 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count); 71 71 this->billboardSet_->createBillboard(position); 72 72 this->billboardSet_->setMaterialName(file); … … 77 77 std::ostringstream name; 78 78 name << (BillboardSet::billboardSetCounter_s++); 79 this->billboardSet_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count);79 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count); 80 80 this->billboardSet_->createBillboard(position, colour); 81 81 this->billboardSet_->setMaterialName(file); … … 85 85 { 86 86 if (this->billboardSet_) 87 GraphicsEngine::get Singleton().getLevelSceneManager()->destroyBillboardSet(this->billboardSet_);87 GraphicsEngine::getInstance().getLevelSceneManager()->destroyBillboardSet(this->billboardSet_); 88 88 } 89 89 } -
code/branches/gui/src/orxonox/tools/Light.cc
r1638 r1653 49 49 std::ostringstream name; 50 50 name << (Light::lightCounter_s++); 51 this->light_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createLight("Light" + name.str());51 this->light_ = GraphicsEngine::getInstance().getLevelSceneManager()->createLight("Light" + name.str()); 52 52 this->light_->setType(type); 53 53 this->light_->setDiffuseColour(diffuse); … … 58 58 { 59 59 if (this->light_) 60 GraphicsEngine::get Singleton().getLevelSceneManager()->destroyLight(this->light_);60 GraphicsEngine::getInstance().getLevelSceneManager()->destroyLight(this->light_); 61 61 } 62 62 } -
code/branches/gui/src/orxonox/tools/Mesh.cc
r1638 r1653 49 49 std::ostringstream name; 50 50 name << (Mesh::meshCounter_s++); 51 this->entity_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createEntity("Mesh" + name.str(), file);51 this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + name.str(), file); 52 52 } 53 53 … … 55 55 { 56 56 if (this->entity_) 57 GraphicsEngine::get Singleton().getLevelSceneManager()->destroyEntity(this->entity_);57 GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_); 58 58 } 59 59 } -
code/branches/gui/src/orxonox/tools/ParticleInterface.cc
r1638 r1653 55 55 this->bEnabled_ = true; 56 56 this->detaillevel_ = (unsigned int)detaillevel; 57 this->particleSystem_ = GraphicsEngine::get Singleton().getLevelSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);57 this->particleSystem_ = GraphicsEngine::getInstance().getLevelSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 58 58 this->particleSystem_->setSpeedFactor(Orxonox::getSingleton().getTimeFactor()); 59 59 60 if (GraphicsEngine::get Singleton().getDetailLevelParticle() < (unsigned int)this->detaillevel_)60 if (GraphicsEngine::getInstance().getDetailLevelParticle() < (unsigned int)this->detaillevel_) 61 61 { 62 62 this->bVisible_ = false; … … 72 72 { 73 73 this->particleSystem_->removeAllEmitters(); 74 GraphicsEngine::get Singleton().getLevelSceneManager()->destroyParticleSystem(particleSystem_);74 GraphicsEngine::getInstance().getLevelSceneManager()->destroyParticleSystem(particleSystem_); 75 75 } 76 76
Note: See TracChangeset
for help on using the changeset viewer.