Changeset 3370 for code/trunk/src/orxonox/gamestates/GSGraphics.cc
- Timestamp:
- Jul 30, 2009, 2:10:44 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/resource (added) merged: 3328,3336-3340,3342-3350,3352-3366
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSGraphics.cc
r3327 r3370 35 35 #include "GSGraphics.h" 36 36 37 #include <boost/filesystem.hpp>38 #include <OgreRenderWindow.h>39 40 37 #include "util/Convert.h" 41 38 #include "core/Clock.h" … … 44 41 #include "core/Core.h" 45 42 #include "core/Game.h" 46 #include "core/G ameMode.h"43 #include "core/GUIManager.h" 47 44 #include "core/input/InputManager.h" 48 45 #include "core/input/KeyBinder.h" … … 51 48 #include "core/XMLFile.h" 52 49 #include "overlays/console/InGameConsole.h" 53 #include "gui/GUIManager.h"54 50 #include "sound/SoundManager.h" 55 #include "GraphicsManager.h" 51 52 // HACK: 53 #include "overlays/map/Map.h" 56 54 57 55 namespace orxonox 58 56 { 59 DeclareGameState(GSGraphics, "graphics", true, true);57 DeclareGameState(GSGraphics, "graphics", false, true); 60 58 61 GSGraphics::GSGraphics(const GameStateConstrParams& params) 62 : GameState(params) 63 , inputManager_(0) 59 GSGraphics::GSGraphics(const GameStateInfo& info) 60 : GameState(info) 64 61 , console_(0) 65 , guiManager_(0)66 , graphicsManager_(0)67 62 , soundManager_(0) 68 63 , masterKeyBinder_(0) … … 70 65 , debugOverlay_(0) 71 66 { 67 // load master key bindings 68 masterInputState_ = InputManager::getInstance().createInputState("master", true); 69 masterKeyBinder_ = new KeyBinder(); 70 masterInputState_->setKeyHandler(masterKeyBinder_); 72 71 } 73 72 74 73 GSGraphics::~GSGraphics() 75 74 { 75 InputManager::getInstance().destroyState("master"); 76 delete this->masterKeyBinder_; 76 77 } 77 78 … … 93 94 void GSGraphics::activate() 94 95 { 95 GameMode::setShowsGraphics(true);96 97 // Load OGRE including the render window98 this->graphicsManager_ = new GraphicsManager();99 100 96 // load debug overlay 101 97 COUT(3) << "Loading Debug Overlay..." << std::endl; 102 this->debugOverlay_ = new XMLFile( (Core::getMediaPath() / "overlay" / "debug.oxo").string());98 this->debugOverlay_ = new XMLFile(Core::getMediaPathString() + "overlay/debug.oxo"); 103 99 Loader::open(debugOverlay_); 104 100 105 // The render window width and height are used to set up the mouse movement.106 size_t windowHnd = 0;107 Ogre::RenderWindow* renderWindow = GraphicsManager::getInstance().getRenderWindow();108 renderWindow->getCustomAttribute("WINDOW", &windowHnd);109 110 // Calls the InputManager which sets up the input devices.111 inputManager_ = new InputManager(windowHnd);112 113 // load master key bindings114 masterInputState_ = InputManager::getInstance().createInputState("master", true);115 masterKeyBinder_ = new KeyBinder();116 101 masterKeyBinder_->loadBindings("masterKeybindings.ini"); 117 masterInputState_->setKeyHandler(masterKeyBinder_);118 102 119 103 // Load the SoundManager … … 123 107 console_ = new InGameConsole(); 124 108 console_->initialise(); 125 126 // load the CEGUI interface127 guiManager_ = new GUIManager();128 guiManager_->initialise(renderWindow);129 109 130 110 // add console command to toggle GUI … … 154 134 */ 155 135 156 masterInputState_->setHandler(0);157 InputManager::getInstance().destroyState("master");158 delete this->masterKeyBinder_;159 160 delete this->guiManager_;161 136 delete this->console_; 162 137 … … 166 141 delete this->soundManager_; 167 142 168 delete this->inputManager_; 169 this->inputManager_ = 0; 170 171 delete graphicsManager_; 172 173 GameMode::setShowsGraphics(false); 143 // HACK: (destroys a resource smart pointer) 144 Map::hackDestroyMap(); 174 145 } 175 146 … … 203 174 } 204 175 205 uint64_t timeBeforeTick = time.getRealMicroseconds();206 207 this->inputManager_->update(time);208 176 this->console_->update(time); 209 210 uint64_t timeAfterTick = time.getRealMicroseconds();211 212 // Also add our tick time213 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);214 215 // Process gui events216 this->guiManager_->update(time);217 // Render218 this->graphicsManager_->update(time);219 177 } 220 178 }
Note: See TracChangeset
for help on using the changeset viewer.