Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 24, 2009, 4:25:33 PM (15 years ago)
Author:
rgrieder
Message:

Expanded Core class by loadGraphics and unloadGraphics which don't do anything at the moment.

Location:
code/branches/resource/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource/src/core/Core.cc

    r3323 r3343  
    6868#include "CoreIncludes.h"
    6969#include "Factory.h"
     70#include "GameMode.h"
    7071#include "Identifier.h"
    7172#include "Language.h"
     
    230231
    231232    Core::Core(const std::string& cmdLine)
     233        : bGraphicsLoaded_(false)
    232234    {
    233235        if (singletonRef_s != 0)
     
    315317        // Destroy command line arguments
    316318        CommandLine::destroyAllArguments();
    317         // Also delete external console command that don't belong to an Identifier
     319        // Also delete external console commands that don't belong to an Identifier
    318320        CommandExecutor::destroyExternalCommands();
    319321        // Clean up class hierarchy stuff (identifiers, XMLPort, configValues, consoleCommand)
     
    323325
    324326        // 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);
    325345    }
    326346
  • code/branches/resource/src/core/Core.h

    r3323 r3343  
    7373            void update(const Clock& time);
    7474
     75            void loadGraphics();
     76            void unloadGraphics();
     77
    7578            static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }
    7679
     
    111114            TclThreadManager*     tclThreadManager_;
    112115
    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_;
    114118            CoreConfiguration*    configuration_;
    115119
  • code/branches/resource/src/core/GameMode.h

    r2896 r3343  
    4141    class _CoreExport GameMode
    4242    {
     43        friend class Core;
     44
    4345        public:
    4446            static bool showsGraphics() { return bShowsGraphics_s; }
     
    4749            static bool isStandalone()  { return bIsStandalone_s; }
    4850            static bool isMaster()      { return bIsMaster_s; }
    49             static void setShowsGraphics(bool val) { bShowsGraphics_s = val; updateIsMaster(); }
     51
    5052            static void setHasServer    (bool val) { bHasServer_s     = val; updateIsMaster(); }
    5153            static void setIsClient     (bool val) { bIsClient_s      = val; updateIsMaster(); }
    5254            static void setIsStandalone (bool val) { bIsStandalone_s  = val; updateIsMaster(); }
    53             static void updateIsMaster  ()         { bIsMaster_s      = (bHasServer_s || bIsStandalone_s); }
    5455
    5556        private:
     
    5758            GameMode(const GameMode& inst);
    5859            ~GameMode();
     60
     61            static void setShowsGraphics(bool val) { bShowsGraphics_s = val; updateIsMaster(); }
     62            static void updateIsMaster  ()         { bIsMaster_s      = (bHasServer_s || bIsStandalone_s); }
    5963
    6064            static bool bShowsGraphics_s;                   //!< global variable that tells whether to show graphics
  • code/branches/resource/src/orxonox/LevelManager.cc

    r3339 r3343  
    3434#include "core/CommandLine.h"
    3535#include "core/ConfigValueIncludes.h"
     36#include "core/Core.h"
    3637#include "core/CoreIncludes.h"
    3738#include "core/Loader.h"
  • code/branches/resource/src/orxonox/OrxonoxPrecompiledHeaders.h

    r3322 r3343  
    9090//#include "core/ConfigValueIncludes.h" // 19
    9191//#include "core/ConsoleCommand.h" // 15
    92 #include "core/Core.h"
     92//#include "core/Core.h" // ?, but not many times
    9393#include "core/CoreIncludes.h"
    94 #include "core/GameMode.h"
    9594#include "core/XMLPort.h"
    9695
  • code/branches/resource/src/orxonox/gamestates/GSGraphics.cc

    r3338 r3343  
    9393    void GSGraphics::activate()
    9494    {
    95         GameMode::setShowsGraphics(true);
     95        // Load OGRE, CEGUI and OIS
     96        Core::getInstance().loadGraphics();
    9697
    9798        // Load OGRE including the render window
     
    170171        delete graphicsManager_;
    171172
    172         GameMode::setShowsGraphics(false);
     173        // Unload OGRE, CEGUI and OIS
     174        Core::getInstance().loadGraphics();
    173175    }
    174176
Note: See TracChangeset for help on using the changeset viewer.