Changeset 3349 for code/branches/resource/src/orxonox/gamestates
- Timestamp:
- Jul 25, 2009, 2:14:05 PM (15 years ago)
- Location:
- code/branches/resource/src/orxonox/gamestates
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource/src/orxonox/gamestates/GSGraphics.cc
r3346 r3349 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/GameMode.h"47 #include "core/GraphicsManager.h"48 43 #include "core/GUIManager.h" 49 44 #include "core/input/InputManager.h" … … 60 55 namespace orxonox 61 56 { 62 DeclareGameState(GSGraphics, "graphics", true, true);57 DeclareGameState(GSGraphics, "graphics", false, true); 63 58 64 59 GSGraphics::GSGraphics(const GameStateConstrParams& params) 65 60 : GameState(params) 66 , inputManager_(0)67 61 , console_(0) 68 , guiManager_(0)69 , graphicsManager_(0)70 62 , soundManager_(0) 71 63 , masterKeyBinder_(0) … … 99 91 Core::getInstance().loadGraphics(); 100 92 101 // Load OGRE including the render window102 this->graphicsManager_ = new GraphicsManager();103 104 93 // load debug overlay 105 94 COUT(3) << "Loading Debug Overlay..." << std::endl; 106 this->debugOverlay_ = new XMLFile( (Core::getMediaPath() / "overlay" / "debug.oxo").string());95 this->debugOverlay_ = new XMLFile(Core::getMediaPathString() + "overlay/debug.oxo"); 107 96 Loader::open(debugOverlay_); 108 109 // The render window width and height are used to set up the mouse movement.110 size_t windowHnd = 0;111 Ogre::RenderWindow* renderWindow = GraphicsManager::getInstance().getRenderWindow();112 renderWindow->getCustomAttribute("WINDOW", &windowHnd);113 114 // Calls the InputManager which sets up the input devices.115 inputManager_ = new InputManager(windowHnd);116 117 97 // load master key bindings 118 98 masterInputState_ = InputManager::getInstance().createInputState("master", true); … … 127 107 console_ = new InGameConsole(); 128 108 console_->initialise(); 129 130 // load the CEGUI interface131 guiManager_ = new GUIManager(renderWindow);132 109 133 110 // add console command to toggle GUI … … 161 138 delete this->masterKeyBinder_; 162 139 163 delete this->guiManager_;164 140 delete this->console_; 165 141 … … 169 145 delete this->soundManager_; 170 146 171 delete this->inputManager_; 172 this->inputManager_ = 0; 173 174 // HACK: 147 // HACK: (destroys a resource smart pointer) 175 148 Map::hackDestroyMap(); 176 177 delete graphicsManager_;178 149 179 150 // Unload OGRE, CEGUI and OIS … … 210 181 } 211 182 212 uint64_t timeBeforeTick = time.getRealMicroseconds();213 214 this->inputManager_->update(time);215 183 this->console_->update(time); 216 217 uint64_t timeAfterTick = time.getRealMicroseconds();218 219 // Also add our tick time220 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);221 222 // Process gui events223 this->guiManager_->update(time);224 // Render225 this->graphicsManager_->update(time);226 184 } 227 185 } -
code/branches/resource/src/orxonox/gamestates/GSGraphics.h
r3327 r3349 61 61 private: 62 62 // managed singletons 63 InputManager* inputManager_; //!< Reference to input management64 63 InGameConsole* console_; 65 GUIManager* guiManager_; //!< Interface to GUI66 GraphicsManager* graphicsManager_; //!< Interface to Ogre67 64 SoundManager* soundManager_; //!< Keeps track of SoundBase objects 68 65 -
code/branches/resource/src/orxonox/gamestates/GSRoot.cc
r3340 r3349 45 45 namespace orxonox 46 46 { 47 DeclareGameState(GSRoot, "root", true, false);47 DeclareGameState(GSRoot, "root", false, false); 48 48 SetCommandLineSwitch(console).information("Start in console mode (text IO only)"); 49 49 // Shortcuts for easy direct loading … … 155 155 } 156 156 157 uint64_t timeBeforeTick = time.getRealMicroseconds();158 159 157 for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it) 160 158 it->tick(time); … … 171 169 it->tick(leveldt * this->timeFactor_); 172 170 /*** HACK *** HACK ***/ 173 174 uint64_t timeAfterTick = time.getRealMicroseconds();175 176 // Also add our tick time177 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);178 171 } 179 172
Note: See TracChangeset
for help on using the changeset viewer.