Changeset 2087 for code/trunk/src/orxonox/gamestates/GSGraphics.cc
- Timestamp:
- Nov 1, 2008, 7:04:09 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSGraphics.cc
r1891 r2087 47 47 #include "core/ConfigValueIncludes.h" 48 48 #include "core/CoreIncludes.h" 49 #include "core/Core.h" 49 50 #include "core/input/InputManager.h" 50 51 #include "core/input/KeyBinder.h" 51 52 #include "core/input/ExtendedInputState.h" 53 #include "core/Loader.h" 54 #include "core/XMLFile.h" 52 55 #include "overlays/console/InGameConsole.h" 53 56 #include "gui/GUIManager.h" 54 57 #include "tools/WindowEventListener.h" 58 #include "objects/Tickable.h" 55 59 #include "Settings.h" 56 60 … … 64 68 , renderWindow_(0) 65 69 , viewport_(0) 70 , bWindowEventListenerUpdateRequired_(false) 66 71 , inputManager_(0) 67 72 , console_(0) … … 76 81 , statisticsStartCount_(0) 77 82 , tickTime_(0) 83 , debugOverlay_(0) 78 84 { 79 85 RegisterRootObject(GSGraphics); … … 101 107 void GSGraphics::enter() 102 108 { 103 Settings::_getInstance().bShowsGraphics_ = true;109 Core::setShowsGraphics(true); 104 110 105 111 // initialise graphics engine. Doesn't load the render window yet! … … 113 119 this->initialiseResources(); 114 120 115 116 // HACK: temporary: 117 graphicsEngine_->renderWindow_ = this->renderWindow_; 118 graphicsEngine_->root_ = this->ogreRoot_; 119 graphicsEngine_->viewport_ = this->viewport_; 120 121 // We want to get informed whenever an object of type WindowEventListener is created 122 // in order to later update the window size. 123 bWindowEventListenerUpdateRequired_ = false; 124 RegisterConstructionCallback(GSGraphics, orxonox::WindowEventListener, requestWindowEventListenerUpdate); 125 126 // load debug overlay 127 COUT(3) << "Loading Debug Overlay..." << std::endl; 128 this->debugOverlay_ = new XMLFile(Settings::getDataPath() + "overlay/debug.oxo"); 129 Loader::open(debugOverlay_); 121 130 122 131 // Calls the InputManager which sets up the input devices. … … 133 142 // Load the InGameConsole 134 143 console_ = new InGameConsole(); 135 console_->initialise( );144 console_->initialise(this->renderWindow_->getWidth(), this->renderWindow_->getHeight()); 136 145 137 146 // load the CEGUI interface … … 165 174 //delete this->masterKeyBinder_; 166 175 delete this->inputManager_; 176 177 Loader::unload(this->debugOverlay_); 178 delete this->debugOverlay_; 167 179 168 180 // destroy render window … … 196 208 delete graphicsEngine_; 197 209 198 Settings::_getInstance().bShowsGraphics_ = false;210 Core::setShowsGraphics(false); 199 211 } 200 212 … … 221 233 this->console_->tick(dt); 222 234 this->tickChild(time); 223 235 236 /*** HACK *** HACK ***/ 237 // Call the Tickable objects 238 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it) 239 it->tick(time.getDeltaTime()); 240 /*** HACK *** HACK ***/ 241 242 if (this->bWindowEventListenerUpdateRequired_) 243 { 244 // Update all WindowEventListeners for the case a new one was created. 245 this->windowResized(this->renderWindow_); 246 this->bWindowEventListenerUpdateRequired_ = false; 247 } 248 224 249 unsigned long long timeAfterTick = time.getRealMicroseconds(); 225 250 … … 487 512 for (ObjectList<orxonox::WindowEventListener>::iterator it = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it) 488 513 it->windowResized(this->renderWindow_->getWidth(), this->renderWindow_->getHeight()); 514 515 // OIS needs this under linux even if we only use relative input measurement. 516 if (this->inputManager_) 517 this->inputManager_->setWindowExtents(renderWindow_->getWidth(), renderWindow_->getHeight()); 489 518 } 490 519 … … 501 530 502 531 // instruct InputManager to clear the buffers (core library so we cannot use the interface) 503 InputManager::getInstance().clearBuffers(); 532 if (this->inputManager_) 533 this->inputManager_->clearBuffers(); 504 534 } 505 535 … … 512 542 void GSGraphics::windowClosed(Ogre::RenderWindow *rw) 513 543 { 514 // using CommandExecutor in order to avoid depending on Orxonox.h.515 //CommandExecutor::execute("exit", false);516 544 this->requestState("root"); 517 545 }
Note: See TracChangeset
for help on using the changeset viewer.