Changeset 3370 for code/trunk/src/orxonox/gamestates
- Timestamp:
- Jul 30, 2009, 2:10:44 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 19 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/GSClient.cc
r3280 r3370 42 42 SetCommandLineArgument(ip, "127.0.0.1").information("Sever IP as strin in the form #.#.#.#"); 43 43 44 GSClient::GSClient(const GameState ConstrParams& params)45 : GameState( params)44 GSClient::GSClient(const GameStateInfo& info) 45 : GameState(info) 46 46 , client_(0) 47 47 { -
code/trunk/src/orxonox/gamestates/GSClient.h
r3280 r3370 40 40 { 41 41 public: 42 GSClient(const GameState ConstrParams& params);42 GSClient(const GameStateInfo& info); 43 43 ~GSClient(); 44 44 -
code/trunk/src/orxonox/gamestates/GSDedicated.cc
r3351 r3370 55 55 termios* GSDedicated::originalTerminalSettings_; 56 56 57 GSDedicated::GSDedicated(const GameState ConstrParams& params)58 : GameState( params)57 GSDedicated::GSDedicated(const GameStateInfo& info) 58 : GameState(info) 59 59 , server_(0) 60 60 , closeThread_(false) -
code/trunk/src/orxonox/gamestates/GSDedicated.h
r3304 r3370 48 48 { 49 49 public: 50 GSDedicated(const GameState ConstrParams& params);50 GSDedicated(const GameStateInfo& info); 51 51 ~GSDedicated(); 52 52 -
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 } -
code/trunk/src/orxonox/gamestates/GSGraphics.h
r3327 r3370 50 50 { 51 51 public: 52 GSGraphics(const GameState ConstrParams& params);52 GSGraphics(const GameStateInfo& info); 53 53 ~GSGraphics(); 54 54 … … 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/trunk/src/orxonox/gamestates/GSIOConsole.cc
r3280 r3370 38 38 DeclareGameState(GSIOConsole, "ioConsole", false, false); 39 39 40 GSIOConsole::GSIOConsole(const GameState ConstrParams& params)41 : GameState( params)40 GSIOConsole::GSIOConsole(const GameStateInfo& info) 41 : GameState(info) 42 42 { 43 43 } -
code/trunk/src/orxonox/gamestates/GSIOConsole.h
r3280 r3370 38 38 { 39 39 public: 40 GSIOConsole(const GameState ConstrParams& params);40 GSIOConsole(const GameStateInfo& info); 41 41 ~GSIOConsole(); 42 42 -
code/trunk/src/orxonox/gamestates/GSLevel.cc
r3327 r3370 40 40 #include "core/GameMode.h" 41 41 #include "core/Core.h" 42 #include "core/GraphicsManager.h" 43 #include "core/GUIManager.h" 42 44 #include "core/Loader.h" 43 45 #include "core/XMLFile.h" … … 47 49 #include "objects/quest/QuestManager.h" 48 50 #include "overlays/notifications/NotificationManager.h" 49 #include "gui/GUIManager.h"50 51 #include "CameraManager.h" 51 #include "GraphicsManager.h"52 52 #include "LevelManager.h" 53 53 #include "PlayerManager.h" … … 55 55 namespace orxonox 56 56 { 57 DeclareGameState(GSLevel, "level", false, true);57 DeclareGameState(GSLevel, "level", false, false); 58 58 SetConsoleCommand(GSLevel, showIngameGUI, true); 59 59 60 60 XMLFile* GSLevel::startFile_s = NULL; 61 61 62 GSLevel::GSLevel(const GameState ConstrParams& params)63 : GameState( params)62 GSLevel::GSLevel(const GameStateInfo& info) 63 : GameState(info) 64 64 , keyBinder_(0) 65 65 , gameInputState_(0) -
code/trunk/src/orxonox/gamestates/GSLevel.h
r3327 r3370 41 41 { 42 42 public: 43 GSLevel(const GameState ConstrParams& params);43 GSLevel(const GameStateInfo& info); 44 44 ~GSLevel(); 45 45 void setConfigValues(); -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r3327 r3370 36 36 #include "core/Clock.h" 37 37 #include "core/ConsoleCommand.h" 38 #include "core/GraphicsManager.h" 39 #include "core/GUIManager.h" 38 40 #include "objects/Scene.h" 39 #include "gui/GUIManager.h"40 41 #include "sound/SoundMainMenu.h" 41 #include "GraphicsManager.h"42 42 43 43 namespace orxonox … … 45 45 DeclareGameState(GSMainMenu, "mainMenu", false, true); 46 46 47 GSMainMenu::GSMainMenu(const GameState ConstrParams& params)48 : GameState( params)47 GSMainMenu::GSMainMenu(const GameStateInfo& info) 48 : GameState(info) 49 49 , inputState_(0) 50 {51 }52 53 GSMainMenu::~GSMainMenu()54 {55 }56 57 void GSMainMenu::activate()58 50 { 59 51 inputState_ = InputManager::getInstance().createInputState("mainMenu"); … … 65 57 // and a Camera 66 58 this->camera_ = this->scene_->getSceneManager()->createCamera("mainMenu/Camera"); 59 } 67 60 61 GSMainMenu::~GSMainMenu() 62 { 63 InputManager::getInstance().destroyState("mainMenu"); 64 65 this->scene_->getSceneManager()->destroyCamera(this->camera_); 66 delete this->scene_; 67 } 68 69 void GSMainMenu::activate() 70 { 68 71 // show main menu 69 GUIManager::getInstance().showGUI("mainmenu_ 3");72 GUIManager::getInstance().showGUI("mainmenu_4"); 70 73 GUIManager::getInstance().setCamera(this->camera_); 71 74 GraphicsManager::getInstance().setCamera(this->camera_); … … 107 110 108 111 InputManager::getInstance().leaveState("mainMenu"); 109 InputManager::getInstance().destroyState("mainMenu");110 112 111 113 GUIManager::getInstance().setCamera(0); 112 114 GraphicsManager::getInstance().setCamera(0); 113 this->scene_->getSceneManager()->destroyCamera(this->camera_);114 delete this->scene_;115 115 116 116 /* -
code/trunk/src/orxonox/gamestates/GSMainMenu.h
r3327 r3370 40 40 { 41 41 public: 42 GSMainMenu(const GameState ConstrParams& params);42 GSMainMenu(const GameStateInfo& info); 43 43 ~GSMainMenu(); 44 44 -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r3304 r3370 30 30 31 31 #include "core/Clock.h" 32 #include "core/CommandLine.h"33 32 #include "core/ConsoleCommand.h" 34 33 #include "core/Game.h" 35 34 #include "core/GameMode.h" 35 #include "core/LuaBind.h" 36 36 #include "network/NetworkFunction.h" 37 #include "ToluaBindCore.h" 38 #include "ToluaBindOrxonox.h" 37 39 #include "tools/Timer.h" 38 40 #include "interfaces/TimeFactorListener.h" … … 42 44 namespace orxonox 43 45 { 44 DeclareGameState(GSRoot, "root", true, false); 45 SetCommandLineSwitch(console).information("Start in console mode (text IO only)"); 46 // Shortcuts for easy direct loading 47 SetCommandLineSwitch(server).information("Start in server mode"); 48 SetCommandLineSwitch(client).information("Start in client mode"); 49 SetCommandLineSwitch(dedicated).information("Start in dedicated server mode"); 50 SetCommandLineSwitch(standalone).information("Start in standalone mode"); 46 DeclareGameState(GSRoot, "root", false, false); 51 47 52 GSRoot::GSRoot(const GameState ConstrParams& params)53 : GameState( params)48 GSRoot::GSRoot(const GameStateInfo& info) 49 : GameState(info) 54 50 , timeFactor_(1.0f) 55 51 , bPaused_(false) … … 58 54 this->ccSetTimeFactor_ = 0; 59 55 this->ccPause_ = 0; 56 57 // Tell LuaBind about all tolua interfaces 58 LuaBind::getInstance().addToluaInterface(&tolua_Core_open, "Core"); 59 LuaBind::getInstance().addToluaInterface(&tolua_Orxonox_open, "Orxonox"); 60 60 } 61 61 … … 88 88 // create the global LevelManager 89 89 this->levelManager_ = new LevelManager(); 90 91 // Load level directly?92 bool loadLevel = false;93 if (CommandLine::getValue("standalone").getBool())94 {95 Game::getInstance().requestStates("graphics, standalone, level");96 loadLevel = true;97 }98 if (CommandLine::getValue("server").getBool())99 {100 Game::getInstance().requestStates("graphics, server, level");101 loadLevel = true;102 }103 if (CommandLine::getValue("client").getBool())104 {105 Game::getInstance().requestStates("graphics, client, level");106 loadLevel = true;107 }108 if (CommandLine::getValue("dedicated").getBool())109 {110 Game::getInstance().requestStates("dedicated, level");111 loadLevel = true;112 }113 114 // Determine where to start otherwise115 if (!loadLevel && !CommandLine::getValue("console").getBool())116 {117 // Also load graphics118 Game::getInstance().requestState("graphics");119 }120 90 } 121 91 … … 148 118 } 149 119 150 uint64_t timeBeforeTick = time.getRealMicroseconds();151 152 120 for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it) 153 121 it->tick(time); … … 164 132 it->tick(leveldt * this->timeFactor_); 165 133 /*** HACK *** HACK ***/ 166 167 uint64_t timeAfterTick = time.getRealMicroseconds();168 169 // Also add our tick time170 Game::getInstance().addTickTime(timeAfterTick - timeBeforeTick);171 134 } 172 135 … … 174 137 @brief 175 138 Changes the speed of Orxonox 139 @remark 140 This function is a hack when placed here! 141 Timefactor should be related to the scene (level or so), not the game 176 142 */ 177 143 void GSRoot::setTimeFactor(float factor) -
code/trunk/src/orxonox/gamestates/GSRoot.h
r3280 r3370 38 38 { 39 39 public: 40 GSRoot(const GameState ConstrParams& params);40 GSRoot(const GameStateInfo& info); 41 41 ~GSRoot(); 42 42 -
code/trunk/src/orxonox/gamestates/GSServer.cc
r3280 r3370 41 41 SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)"); 42 42 43 GSServer::GSServer(const GameState ConstrParams& params)44 : GameState( params)43 GSServer::GSServer(const GameStateInfo& info) 44 : GameState(info) 45 45 , server_(0) 46 46 { -
code/trunk/src/orxonox/gamestates/GSServer.h
r3280 r3370 40 40 { 41 41 public: 42 GSServer(const GameState ConstrParams& params);42 GSServer(const GameStateInfo& info); 43 43 ~GSServer(); 44 44 -
code/trunk/src/orxonox/gamestates/GSStandalone.cc
r3280 r3370 36 36 DeclareGameState(GSStandalone, "standalone", false, true); 37 37 38 GSStandalone::GSStandalone(const GameState ConstrParams& params)39 : GameState( params)38 GSStandalone::GSStandalone(const GameStateInfo& info) 39 : GameState(info) 40 40 { 41 41 } -
code/trunk/src/orxonox/gamestates/GSStandalone.h
r3280 r3370 38 38 { 39 39 public: 40 GSStandalone(const GameState ConstrParams& params);40 GSStandalone(const GameStateInfo& info); 41 41 ~GSStandalone(); 42 42
Note: See TracChangeset
for help on using the changeset viewer.