Changeset 2801 for code/branches/gui/src/orxonox/gamestates
- Timestamp:
- Mar 19, 2009, 10:58:43 AM (16 years ago)
- Location:
- code/branches/gui/src/orxonox/gamestates
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/orxonox/gamestates/GSClient.cc
r2800 r2801 59 59 ThrowException(InitialisationFailed, "Could not establish connection with server."); 60 60 61 GSLevel::enter( this->getParent()->getViewport());61 GSLevel::enter(); 62 62 63 63 // TODO: Get Clock from Game or GameStateManager, but with 0 delta time -
code/branches/gui/src/orxonox/gamestates/GSDedicated.cc
r2800 r2801 58 58 COUT(0) << "Loading scene in server mode" << std::endl; 59 59 60 GSLevel::enter( 0);60 GSLevel::enter(); 61 61 62 62 server_->open(); -
code/branches/gui/src/orxonox/gamestates/GSGUI.cc
r2800 r2801 35 35 #include "core/input/SimpleInputState.h" 36 36 #include "gui/GUIManager.h" 37 #include "GraphicsManager.h" 37 38 38 39 namespace orxonox … … 49 50 void GSGUI::enter() 50 51 { 51 guiManager_ = getParent()->getGUIManager();52 guiManager_ = GUIManager::getInstancePtr(); 52 53 53 54 // show main menu 54 55 guiManager_->loadScene("MainMenu"); 55 56 guiManager_->showGUI("MainMenu", 0); 56 getParent()->getViewport()->setCamera(guiManager_->getCamera());57 GraphicsManager::getInstance().getViewport()->setCamera(guiManager_->getCamera()); 57 58 } 58 59 -
code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
r2800 r2801 30 30 #include "GSGraphics.h" 31 31 32 #include <fstream>33 32 #include <boost/filesystem.hpp> 33 #include <OgreRenderWindow.h> 34 34 35 #include <OgreCompositorManager.h>36 #include <OgreConfigFile.h>37 #include <OgreFrameListener.h>38 #include <OgreRoot.h>39 #include <OgreLogManager.h>40 #include <OgreException.h>41 #include <OgreRenderWindow.h>42 #include <OgreRenderSystem.h>43 #include <OgreTextureManager.h>44 #include <OgreViewport.h>45 #include <OgreWindowEventUtilities.h>46 47 #include "SpecialConfig.h"48 35 #include "util/Debug.h" 49 #include "util/Exception.h"50 #include "util/String.h"51 #include "util/SubString.h"52 #include "core/ConsoleCommand.h"53 36 #include "core/ConfigValueIncludes.h" 54 37 #include "core/CoreIncludes.h" … … 61 44 #include "overlays/console/InGameConsole.h" 62 45 #include "gui/GUIManager.h" 63 #include "tools/WindowEventListener.h"64 46 65 47 // for compatibility 66 #include "Graphics Engine.h"48 #include "GraphicsManager.h" 67 49 68 50 namespace orxonox … … 70 52 GSGraphics::GSGraphics() 71 53 : GameState<GSRoot>("graphics") 72 , renderWindow_(0)73 , viewport_(0)74 , bWindowEventListenerUpdateRequired_(false)75 54 , inputManager_(0) 76 55 , console_(0) 77 56 , guiManager_(0) 78 , ogreRoot_(0) 79 , ogreLogger_(0) 80 , graphicsEngine_(0) 57 , graphicsManager_(0) 81 58 , masterKeyBinder_(0) 82 59 , debugOverlay_(0) … … 92 69 void GSGraphics::setConfigValues() 93 70 { 94 SetConfigValue(resourceFile_, "resources.cfg")95 .description("Location of the resources file in the data path.");96 SetConfigValue(ogreConfigFile_, "ogre.cfg")97 .description("Location of the Ogre config file");98 SetConfigValue(ogrePluginsFolder_, ORXONOX_OGRE_PLUGINS_FOLDER)99 .description("Folder where the Ogre plugins are located.");100 SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)101 .description("Comma separated list of all plugins to load.");102 SetConfigValue(ogreLogFile_, "ogre.log")103 .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");104 SetConfigValue(ogreLogLevelTrivial_ , 5)105 .description("Corresponding orxonox debug level for ogre Trivial");106 SetConfigValue(ogreLogLevelNormal_ , 4)107 .description("Corresponding orxonox debug level for ogre Normal");108 SetConfigValue(ogreLogLevelCritical_, 2)109 .description("Corresponding orxonox debug level for ogre Critical");110 71 } 111 72 … … 115 76 116 77 // initialise graphics engine. Doesn't load the render window yet! 117 graphicsEngine_ = new GraphicsEngine(); 118 119 // Ogre setup procedure 120 setupOgre(); 121 // load all the required plugins for Ogre 122 loadOgrePlugins(); 123 // read resource declaration file 124 this->declareResources(); 125 // Reads ogre config and creates the render window 126 this->loadRenderer(); 127 128 // TODO: Spread this so that this call only initialises things needed for the Console and GUI 129 this->initialiseResources(); 130 131 // We want to get informed whenever an object of type WindowEventListener is created 132 // in order to later update the window size. 133 bWindowEventListenerUpdateRequired_ = false; 134 RegisterConstructionCallback(GSGraphics, orxonox::WindowEventListener, requestWindowEventListenerUpdate); 78 this->graphicsManager_ = new GraphicsManager(); 79 this->graphicsManager_->initialise(); 135 80 136 81 // load debug overlay … … 143 88 inputManager_ = new InputManager(); 144 89 size_t windowHnd = 0; 145 this->renderWindow_->getCustomAttribute("WINDOW", &windowHnd); 146 inputManager_->initialise(windowHnd, renderWindow_->getWidth(), renderWindow_->getHeight(), true); 90 Ogre::RenderWindow* renderWindow = GraphicsManager::getInstance().getRenderWindow(); 91 renderWindow->getCustomAttribute("WINDOW", &windowHnd); 92 inputManager_->initialise(windowHnd, renderWindow->getWidth(), renderWindow->getHeight(), true); 147 93 // Configure master input state with a KeyBinder 148 94 masterKeyBinder_ = new KeyBinder(); … … 152 98 // Load the InGameConsole 153 99 console_ = new InGameConsole(); 154 console_->initialise( this->renderWindow_->getWidth(), this->renderWindow_->getHeight());100 console_->initialise(renderWindow->getWidth(), renderWindow->getHeight()); 155 101 156 102 // load the CEGUI interface 157 103 guiManager_ = new GUIManager(); 158 guiManager_->initialise(this->renderWindow_); 159 160 // add console commands 161 FunctorMember<GSGraphics>* functor1 = createFunctor(&GSGraphics::printScreen); 162 functor1->setObject(this); 163 ccPrintScreen_ = createConsoleCommand(functor1, "printScreen"); 164 CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_); 104 guiManager_->initialise(renderWindow); 165 105 } 166 106 167 107 void GSGraphics::leave() 168 108 { 169 using namespace Ogre;170 171 delete this->ccPrintScreen_;172 173 // remove our WindowEventListener first to avoid bad calls after the window has been destroyed174 Ogre::WindowEventUtilities::removeWindowEventListener(this->renderWindow_, this);175 176 109 delete this->guiManager_; 177 110 … … 185 118 delete this->debugOverlay_; 186 119 187 // unload all compositors 188 Ogre::CompositorManager::getSingleton().removeAll(); 189 190 // destroy render window 191 RenderSystem* renderer = this->ogreRoot_->getRenderSystem(); 192 renderer->destroyRenderWindow("Orxonox"); 193 194 /*** CODE SNIPPET, UNUSED ***/ 195 // Does the opposite of initialise() 196 //ogreRoot_->shutdown(); 197 // Remove all resources and resource groups 198 //StringVector groups = ResourceGroupManager::getSingleton().getResourceGroups(); 199 //for (StringVector::iterator it = groups.begin(); it != groups.end(); ++it) 200 //{ 201 // ResourceGroupManager::getSingleton().destroyResourceGroup(*it); 202 //} 203 204 //ParticleSystemManager::getSingleton().removeAllTemplates(); 205 206 // Shutdown the render system 207 //this->ogreRoot_->setRenderSystem(0); 208 209 delete this->ogreRoot_; 210 211 // delete the ogre log and the logManager (since we have created it). 212 this->ogreLogger_->getDefaultLog()->removeListener(this); 213 this->ogreLogger_->destroyLog(Ogre::LogManager::getSingleton().getDefaultLog()); 214 delete this->ogreLogger_; 215 216 delete graphicsEngine_; 217 218 Core::setShowsGraphics(false); 120 delete graphicsManager_; 219 121 } 220 122 … … 231 133 uint64_t timeBeforeTick = time.getRealMicroseconds(); 232 134 233 float dt = time.getDeltaTime(); 234 235 this->inputManager_->update(time); 236 // tick console 135 this->inputManager_->update(time); // tick console 237 136 this->console_->update(time); 238 137 this->tickChild(time); 239 240 if (this->bWindowEventListenerUpdateRequired_)241 {242 // Update all WindowEventListeners for the case a new one was created.243 this->windowResized(this->renderWindow_);244 this->bWindowEventListenerUpdateRequired_ = false;245 }246 138 247 139 uint64_t timeAfterTick = time.getRealMicroseconds(); … … 251 143 252 144 // Update statistics overlay. Note that the values only change periodically in GSRoot. 253 Graphics Engine::getInstance().setAverageFramesPerSecond(this->getParent()->getAvgFPS());254 Graphics Engine::getInstance().setAverageTickTime(this->getParent()->getAvgTickTime());145 GraphicsManager::getInstance().setAverageFramesPerSecond(this->getParent()->getAvgFPS()); 146 GraphicsManager::getInstance().setAverageTickTime(this->getParent()->getAvgTickTime()); 255 147 256 // don't forget to call _fireFrameStarted in ogre to make sure 257 // everything goes smoothly 258 Ogre::FrameEvent evt; 259 evt.timeSinceLastFrame = dt; 260 evt.timeSinceLastEvent = dt; // note: same time, but shouldn't matter anyway 261 ogreRoot_->_fireFrameStarted(evt); 262 263 // Pump messages in all registered RenderWindows 264 // This calls the WindowEventListener objects. 265 Ogre::WindowEventUtilities::messagePump(); 266 // make sure the window stays active even when not focused 267 // (probably only necessary on windows) 268 this->renderWindow_->setActive(true); 269 270 // render 271 ogreRoot_->_updateAllRenderTargets(); 272 273 // again, just to be sure ogre works fine 274 ogreRoot_->_fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted 275 } 276 277 /** 278 @brief 279 Creates the Ogre Root object and sets up the ogre log. 280 */ 281 void GSGraphics::setupOgre() 282 { 283 COUT(3) << "Setting up Ogre..." << std::endl; 284 285 if (ogreConfigFile_ == "") 286 { 287 COUT(2) << "Warning: Ogre config file set to \"\". Defaulting to config.cfg" << std::endl; 288 ModifyConfigValue(ogreConfigFile_, tset, "config.cfg"); 289 } 290 if (ogreLogFile_ == "") 291 { 292 COUT(2) << "Warning: Ogre log file set to \"\". Defaulting to ogre.log" << std::endl; 293 ModifyConfigValue(ogreLogFile_, tset, "ogre.log"); 294 } 295 296 boost::filesystem::path ogreConfigFilepath(Core::getConfigPath() / this->ogreConfigFile_); 297 boost::filesystem::path ogreLogFilepath(Core::getLogPath() / this->ogreLogFile_); 298 299 // create a new logManager 300 // Ogre::Root will detect that we've already created a Log 301 ogreLogger_ = new Ogre::LogManager(); 302 COUT(4) << "Ogre LogManager created" << std::endl; 303 304 // create our own log that we can listen to 305 Ogre::Log *myLog; 306 myLog = ogreLogger_->createLog(ogreLogFilepath.string(), true, false, false); 307 COUT(4) << "Ogre Log created" << std::endl; 308 309 myLog->setLogDetail(Ogre::LL_BOREME); 310 myLog->addListener(this); 311 312 COUT(4) << "Creating Ogre Root..." << std::endl; 313 314 // check for config file existence because Ogre displays (caught) exceptions if not 315 if (!boost::filesystem::exists(ogreConfigFilepath)) 316 { 317 // create a zero sized file 318 std::ofstream creator; 319 creator.open(ogreConfigFilepath.string().c_str()); 320 creator.close(); 321 } 322 323 // Leave plugins file empty. We're going to do that part manually later 324 ogreRoot_ = new Ogre::Root("", ogreConfigFilepath.string(), ogreLogFilepath.string()); 325 326 COUT(3) << "Ogre set up done." << std::endl; 327 } 328 329 void GSGraphics::loadOgrePlugins() 330 { 331 // just to make sure the next statement doesn't segfault 332 if (ogrePluginsFolder_ == "") 333 ogrePluginsFolder_ = "."; 334 335 boost::filesystem::path folder(ogrePluginsFolder_); 336 // Do some SubString magic to get the comma separated list of plugins 337 SubString plugins(ogrePlugins_, ",", " ", false, 92, false, 34, false, 40, 41, false, '\0'); 338 // Use backslash paths on Windows! file_string() already does that though. 339 for (unsigned int i = 0; i < plugins.size(); ++i) 340 ogreRoot_->loadPlugin((folder / plugins[i]).file_string()); 341 } 342 343 void GSGraphics::declareResources() 344 { 345 CCOUT(4) << "Declaring Resources" << std::endl; 346 //TODO: Specify layout of data file and maybe use xml-loader 347 //TODO: Work with ressource groups (should be generated by a special loader) 348 349 if (resourceFile_ == "") 350 { 351 COUT(2) << "Warning: Ogre resource file set to \"\". Defaulting to resources.cfg" << std::endl; 352 ModifyConfigValue(resourceFile_, tset, "resources.cfg"); 353 } 354 355 // Load resource paths from data file using configfile ressource type 356 Ogre::ConfigFile cf; 357 try 358 { 359 cf.load((Core::getMediaPath() / resourceFile_).string()); 360 } 361 catch (...) 362 { 363 //COUT(1) << ex.getFullDescription() << std::endl; 364 COUT(0) << "Have you forgotten to set the data path in orxnox.ini?" << std::endl; 365 throw; 366 } 367 368 // Go through all sections & settings in the file 369 Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator(); 370 371 std::string secName, typeName, archName; 372 while (seci.hasMoreElements()) 373 { 374 try 375 { 376 secName = seci.peekNextKey(); 377 Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext(); 378 Ogre::ConfigFile::SettingsMultiMap::iterator i; 379 for (i = settings->begin(); i != settings->end(); ++i) 380 { 381 typeName = i->first; // for instance "FileSystem" or "Zip" 382 archName = i->second; // name (and location) of archive 383 384 Ogre::ResourceGroupManager::getSingleton().addResourceLocation( 385 (Core::getMediaPath() / archName).string(), typeName, secName); 386 } 387 } 388 catch (Ogre::Exception& ex) 389 { 390 COUT(1) << ex.getFullDescription() << std::endl; 391 } 392 } 393 } 394 395 void GSGraphics::loadRenderer() 396 { 397 CCOUT(4) << "Configuring Renderer" << std::endl; 398 399 if (!ogreRoot_->restoreConfig()) 400 if (!ogreRoot_->showConfigDialog()) 401 ThrowException(InitialisationFailed, "Could not show Ogre configuration dialogue."); 402 403 CCOUT(4) << "Creating render window" << std::endl; 404 405 this->renderWindow_ = ogreRoot_->initialise(true, "Orxonox"); 406 407 Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this); 408 409 Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(0); 410 411 // create a full screen default viewport 412 this->viewport_ = this->renderWindow_->addViewport(0, 0); 413 414 if (this->graphicsEngine_) 415 this->graphicsEngine_->setViewport(this->viewport_); 416 } 417 418 void GSGraphics::initialiseResources() 419 { 420 CCOUT(4) << "Initialising resources" << std::endl; 421 //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load... 422 //try 423 //{ 424 Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); 425 /*Ogre::StringVector str = Ogre::ResourceGroupManager::getSingleton().getResourceGroups(); 426 for (unsigned int i = 0; i < str.size(); i++) 427 { 428 Ogre::ResourceGroupManager::getSingleton().loadResourceGroup(str[i]); 429 }*/ 430 //} 431 //catch (...) 432 //{ 433 // CCOUT(2) << "Error: There was a serious error when initialising the resources." << std::endl; 434 // throw; 435 //} 436 } 437 438 /** 439 @brief 440 Method called by the LogListener interface from Ogre. 441 We use it to capture Ogre log messages and handle it ourselves. 442 @param message 443 The message to be logged 444 @param lml 445 The message level the log is using 446 @param maskDebug 447 If we are printing to the console or not 448 @param logName 449 The name of this log (so you can have several listeners 450 for different logs, and identify them) 451 */ 452 void GSGraphics::messageLogged(const std::string& message, 453 Ogre::LogMessageLevel lml, bool maskDebug, const std::string& logName) 454 { 455 int orxonoxLevel; 456 switch (lml) 457 { 458 case Ogre::LML_TRIVIAL: 459 orxonoxLevel = this->ogreLogLevelTrivial_; 460 break; 461 case Ogre::LML_NORMAL: 462 orxonoxLevel = this->ogreLogLevelNormal_; 463 break; 464 case Ogre::LML_CRITICAL: 465 orxonoxLevel = this->ogreLogLevelCritical_; 466 break; 467 default: 468 orxonoxLevel = 0; 469 } 470 OutputHandler::getOutStream().setOutputLevel(orxonoxLevel) 471 << "Ogre: " << message << std::endl; 472 } 473 474 /** 475 @brief 476 Window has moved. 477 @param rw 478 The render window it occured in 479 */ 480 void GSGraphics::windowMoved(Ogre::RenderWindow *rw) 481 { 482 for (ObjectList<orxonox::WindowEventListener>::iterator it = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it) 483 it->windowMoved(); 148 this->graphicsManager_->update(time); 484 149 } 485 150 … … 490 155 The render window it occured in 491 156 @note 492 Graphics Enginehas a render window stored itself. This is the same157 GraphicsManager has a render window stored itself. This is the same 493 158 as rw. But we have to be careful when using multiple render windows! 494 159 */ 495 void GSGraphics::windowResized( Ogre::RenderWindow *rw)160 void GSGraphics::windowResized(unsigned int newWidth, unsigned int newHeight) 496 161 { 497 for (ObjectList<orxonox::WindowEventListener>::iterator it = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)498 it->windowResized(this->renderWindow_->getWidth(), this->renderWindow_->getHeight());499 500 162 // OIS needs this under linux even if we only use relative input measurement. 501 163 if (this->inputManager_) 502 this->inputManager_->setWindowExtents( renderWindow_->getWidth(), renderWindow_->getHeight());164 this->inputManager_->setWindowExtents(newWidth, newHeight); 503 165 } 504 166 … … 509 171 The render window it occured in 510 172 */ 511 void GSGraphics::windowFocusChange (Ogre::RenderWindow *rw)173 void GSGraphics::windowFocusChanged() 512 174 { 513 for (ObjectList<orxonox::WindowEventListener>::iterator it = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)514 it->windowFocusChanged();515 516 175 // instruct InputManager to clear the buffers (core library so we cannot use the interface) 517 176 if (this->inputManager_) … … 519 178 } 520 179 521 /**522 @brief523 Window was closed.524 @param rw525 The render window it occured in526 */527 void GSGraphics::windowClosed(Ogre::RenderWindow *rw)528 {529 this->requestState("root");530 }531 532 void GSGraphics::printScreen()533 {534 if (this->renderWindow_)535 {536 this->renderWindow_->writeContentsToTimestampedFile("shot_", ".jpg");537 }538 }539 180 } -
code/branches/gui/src/orxonox/gamestates/GSGraphics.h
r2799 r2801 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #define NOMINMAX // required to stop windows.h screwing up std::min definition34 #include <OgreWindowEventUtilities.h>35 #include <OgreLog.h>36 33 #include "core/GameState.h" 37 34 #include "core/OrxonoxClass.h" 35 #include "tools/WindowEventListener.h" 38 36 #include "GSRoot.h" 39 37 40 38 namespace orxonox 41 39 { 42 class _OrxonoxExport GSGraphics : public GameState<GSRoot>, public OrxonoxClass, 43 public Ogre::WindowEventListener, public Ogre::LogListener 40 class _OrxonoxExport GSGraphics : public GameState<GSRoot>, public WindowEventListener 44 41 { 45 42 friend class ClassIdentifier<GSGraphics>; … … 48 45 GSGraphics(); 49 46 ~GSGraphics(); 50 51 Ogre::Root* getOgreRoot() { return this->ogreRoot_ ; }52 Ogre::Viewport* getViewport() { return this->viewport_ ; }53 GUIManager* getGUIManager() { return this->guiManager_; }54 47 55 48 private: // functions … … 60 53 void setConfigValues(); 61 54 62 void setupOgre(); 63 void loadOgrePlugins(); 64 void declareResources(); 65 void loadRenderer(); 66 void initialiseResources(); 55 // Window events from WindowEventListener 56 void windowResized(unsigned int newWidth, unsigned int newHeight); 57 void windowFocusChanged(); 67 58 68 // console commands 69 void printScreen(); 70 71 // event from Ogre::LogListener 72 void messageLogged(const std::string& message, Ogre::LogMessageLevel lml, 73 bool maskDebug, const std::string& logName); 74 75 // window events from Ogre::WindowEventListener 76 void windowMoved (Ogre::RenderWindow* rw); 77 void windowResized (Ogre::RenderWindow* rw); 78 void windowFocusChange (Ogre::RenderWindow* rw); 79 void windowClosed (Ogre::RenderWindow* rw); 80 81 void requestWindowEventListenerUpdate() { this->bWindowEventListenerUpdateRequired_ = true; } 82 83 private: // variables 84 Ogre::RenderWindow* renderWindow_; //!< the current render window 85 Ogre::Viewport* viewport_; //!< default full size viewport 86 bool bWindowEventListenerUpdateRequired_; //!< True if a new WindowEventListener was created but not yet updated. 87 59 private: 88 60 // managed singletons 89 61 InputManager* inputManager_; 90 62 InGameConsole* console_; 91 63 GUIManager* guiManager_; 92 Ogre::Root* ogreRoot_; //!< Ogre's root 93 Ogre::LogManager* ogreLogger_; 94 GraphicsEngine* graphicsEngine_; //!< Interface to Ogre 64 GraphicsManager* graphicsManager_; //!< Interface to Ogre 95 65 96 66 KeyBinder* masterKeyBinder_; 97 67 XMLFile* debugOverlay_; 98 99 // config values100 std::string resourceFile_; //!< resources file name101 std::string ogreConfigFile_; //!< ogre config file name102 std::string ogrePluginsFolder_; //!< Folder where the Ogre plugins are located103 std::string ogrePlugins_; //!< Comma separated list of all plugins to load104 std::string ogreLogFile_; //!< log file name for Ogre log messages105 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL106 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL107 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL108 109 // console commands110 ConsoleCommand* ccPrintScreen_;111 68 }; 112 69 } -
code/branches/gui/src/orxonox/gamestates/GSLevel.cc
r2759 r2801 44 44 #include "objects/Radar.h" 45 45 #include "CameraManager.h" 46 #include "GraphicsManager.h" 46 47 #include "LevelManager.h" 47 48 #include "PlayerManager.h" … … 77 78 } 78 79 79 void GSLevel::enter( Ogre::Viewport* viewport)80 void GSLevel::enter() 80 81 { 81 82 if (Core::showsGraphics()) … … 87 88 88 89 // create the global CameraManager 89 assert(viewport); 90 this->cameraManager_ = new CameraManager(viewport); 90 this->cameraManager_ = new CameraManager(GraphicsManager::getInstance().getViewport()); 91 91 92 92 // Start the Radar -
code/branches/gui/src/orxonox/gamestates/GSLevel.h
r2790 r2801 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #include <OgrePrerequisites.h>34 33 #include "core/OrxonoxClass.h" 35 34 … … 47 46 48 47 protected: 49 void enter( Ogre::Viewport* viewport);48 void enter(); 50 49 void leave(); 51 50 void ticked(const Clock& time); -
code/branches/gui/src/orxonox/gamestates/GSServer.cc
r2800 r2801 55 55 COUT(0) << "Loading scene in server mode" << std::endl; 56 56 57 GSLevel::enter( this->getParent()->getViewport());57 GSLevel::enter(); 58 58 59 59 server_->open(); -
code/branches/gui/src/orxonox/gamestates/GSStandalone.cc
r2800 r2801 35 35 #include "core/ConsoleCommand.h" 36 36 #include "gui/GUIManager.h" 37 #include "GraphicsManager.h" 37 38 38 39 namespace orxonox … … 60 61 Core::setIsStandalone(true); 61 62 62 GSLevel::enter( this->getParent()->getViewport());63 GSLevel::enter(); 63 64 64 guiManager_ = getParent()->getGUIManager();65 guiManager_ = GUIManager::getInstancePtr(); 65 66 // not sure if necessary 66 67 // guiManager_->loadScene("IngameMenu"); … … 78 79 if (guiShowing_s) 79 80 { 80 guiManager_->showGUI("IngameMenu", this->getParent()->getViewport()->getCamera()->getSceneManager()); 81 Ogre::Viewport* viewport = GraphicsManager::getInstance().getViewport(); 82 guiManager_->showGUI("IngameMenu", viewport->getCamera()->getSceneManager()); 81 83 } 82 84 else
Note: See TracChangeset
for help on using the changeset viewer.