Changeset 3343
- Timestamp:
- Jul 24, 2009, 4:25:33 PM (15 years ago)
- Location:
- code/branches/resource/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource/src/core/Core.cc
r3323 r3343 68 68 #include "CoreIncludes.h" 69 69 #include "Factory.h" 70 #include "GameMode.h" 70 71 #include "Identifier.h" 71 72 #include "Language.h" … … 230 231 231 232 Core::Core(const std::string& cmdLine) 233 : bGraphicsLoaded_(false) 232 234 { 233 235 if (singletonRef_s != 0) … … 315 317 // Destroy command line arguments 316 318 CommandLine::destroyAllArguments(); 317 // Also delete external console command that don't belong to an Identifier319 // Also delete external console commands that don't belong to an Identifier 318 320 CommandExecutor::destroyExternalCommands(); 319 321 // Clean up class hierarchy stuff (identifiers, XMLPort, configValues, consoleCommand) … … 323 325 324 326 // Don't assign singletonRef_s with NULL! Recreation is not supported 327 } 328 329 void Core::loadGraphics() 330 { 331 if (bGraphicsLoaded_) 332 return; 333 334 GameMode::setShowsGraphics(true); 335 bGraphicsLoaded_ = true; 336 } 337 338 void Core::unloadGraphics() 339 { 340 if (!bGraphicsLoaded_) 341 return; 342 343 bGraphicsLoaded_ = false; 344 GameMode::setShowsGraphics(false); 325 345 } 326 346 -
code/branches/resource/src/core/Core.h
r3323 r3343 73 73 void update(const Clock& time); 74 74 75 void loadGraphics(); 76 void unloadGraphics(); 77 75 78 static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; } 76 79 … … 111 114 TclThreadManager* tclThreadManager_; 112 115 113 bool isDevBuild_; //!< True for builds in the build directory (not installed) 116 bool isDevBuild_; //!< True for builds in the build directory (not installed) 117 bool bGraphicsLoaded_; 114 118 CoreConfiguration* configuration_; 115 119 -
code/branches/resource/src/core/GameMode.h
r2896 r3343 41 41 class _CoreExport GameMode 42 42 { 43 friend class Core; 44 43 45 public: 44 46 static bool showsGraphics() { return bShowsGraphics_s; } … … 47 49 static bool isStandalone() { return bIsStandalone_s; } 48 50 static bool isMaster() { return bIsMaster_s; } 49 static void setShowsGraphics(bool val) { bShowsGraphics_s = val; updateIsMaster(); } 51 50 52 static void setHasServer (bool val) { bHasServer_s = val; updateIsMaster(); } 51 53 static void setIsClient (bool val) { bIsClient_s = val; updateIsMaster(); } 52 54 static void setIsStandalone (bool val) { bIsStandalone_s = val; updateIsMaster(); } 53 static void updateIsMaster () { bIsMaster_s = (bHasServer_s || bIsStandalone_s); }54 55 55 56 private: … … 57 58 GameMode(const GameMode& inst); 58 59 ~GameMode(); 60 61 static void setShowsGraphics(bool val) { bShowsGraphics_s = val; updateIsMaster(); } 62 static void updateIsMaster () { bIsMaster_s = (bHasServer_s || bIsStandalone_s); } 59 63 60 64 static bool bShowsGraphics_s; //!< global variable that tells whether to show graphics -
code/branches/resource/src/orxonox/LevelManager.cc
r3339 r3343 34 34 #include "core/CommandLine.h" 35 35 #include "core/ConfigValueIncludes.h" 36 #include "core/Core.h" 36 37 #include "core/CoreIncludes.h" 37 38 #include "core/Loader.h" -
code/branches/resource/src/orxonox/OrxonoxPrecompiledHeaders.h
r3322 r3343 90 90 //#include "core/ConfigValueIncludes.h" // 19 91 91 //#include "core/ConsoleCommand.h" // 15 92 #include "core/Core.h" 92 //#include "core/Core.h" // ?, but not many times 93 93 #include "core/CoreIncludes.h" 94 #include "core/GameMode.h"95 94 #include "core/XMLPort.h" 96 95 -
code/branches/resource/src/orxonox/gamestates/GSGraphics.cc
r3338 r3343 93 93 void GSGraphics::activate() 94 94 { 95 GameMode::setShowsGraphics(true); 95 // Load OGRE, CEGUI and OIS 96 Core::getInstance().loadGraphics(); 96 97 97 98 // Load OGRE including the render window … … 170 171 delete graphicsManager_; 171 172 172 GameMode::setShowsGraphics(false); 173 // Unload OGRE, CEGUI and OIS 174 Core::getInstance().loadGraphics(); 173 175 } 174 176
Note: See TracChangeset
for help on using the changeset viewer.