Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 25, 2009, 7:37:00 PM (15 years ago)
Author:
rgrieder
Message:

Exported showsGraphics, etc. to a new class named GameMode in the core.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/core/GameMode.h

    r2843 r2848  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
    2423 *      Reto Grieder
    2524 *   Co-authors:
     
    3029/**
    3130    @file
    32     @brief Declaration of the Core class.
    33 
    34     The Core class is a singleton, only used to configure some variables
    35     in the core through the config-file.
     31    @brief Declaration of the GameMode class.
    3632*/
    3733
    38 #ifndef _Core_H__
    39 #define _Core_H__
     34#ifndef _GameMode_H__
     35#define _GameMode_H__
    4036
    4137#include "CorePrereqs.h"
    4238
    43 #include <cassert>
    44 #include "OrxonoxClass.h"
    45 #include "util/OutputHandler.h"
    46 
    47 // Only allow main to access postMainInitialisation, so we need a forward declaration
    48 int main(int, char**);
    49 // boost::filesystem header has quite a large tail, use forward declaration
    50 namespace boost { namespace filesystem
    51 {
    52     struct path_traits;
    53     template<class String, class Traits> class basic_path;
    54     typedef basic_path< std::string, path_traits> path;
    55 } }
    56 
    5739namespace orxonox
    5840{
    59     //! The Core class is a singleton, only used to configure some config-values.
    60     class _CoreExport Core : public OrxonoxClass
     41    class _CoreExport GameMode
    6142    {
    6243        public:
    63             Core();
    64             ~Core();
    65 
    66             Clock* initialise(int argc, char** argv);
    67             void setConfigValues();
    68 
    69             void update(const Clock& time);
    70 
    71             static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }
    72 
    73             static int   getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
    74             static void  setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
    75             static const std::string& getLanguage();
    76             static void  resetLanguage();
    77 
    78             static const Clock& getGameClock() { return *getInstance().gameClock_; }
    79 
    80             static void tsetMediaPath(const std::string& path)
    81             { assert(singletonRef_s); singletonRef_s->_tsetMediaPath(path); }
    82             static const boost::filesystem::path& getMediaPath();
    83             static const boost::filesystem::path& getConfigPath();
    84             static const boost::filesystem::path& getLogPath();
    85             static std::string getMediaPathString();
    86             static std::string getConfigPathString();
    87             static std::string getLogPathString();
    88 
    89             // fast access global variables.
    9044            static bool showsGraphics() { return bShowsGraphics_s; }
    9145            static bool hasServer()     { return bHasServer_s; }
     
    10054
    10155        private:
    102             Core(const Core&);
    103 
    104             void checkDevBuild();
    105             void setExecutablePath();
    106             void createDirectories();
    107             void setThreadAffinity(int limitToCPU);
    108 
    109             void resetLanguageIntern();
    110             void initializeRandomNumberGenerator();
    111             void debugLevelChanged();
    112             void languageChanged();
    113             void mediaPathChanged();
    114             void _tsetMediaPath(const std::string& path);
    115 
    116             // Singletons
    117             ConfigFileManager*    configFileManager_;
    118             Language*             languageInstance_;
    119             LuaBind*              luaBind_;
    120             Shell*                shell_;
    121             SignalHandler*        signalHandler_;
    122             TclBind*              tclBind_;
    123             TclThreadManager*     tclThreadManager_;
    124 
    125             Clock*                gameClock_;
    126 
    127             int softDebugLevel_;                            //!< The debug level
    128             int softDebugLevelConsole_;                     //!< The debug level for the console
    129             int softDebugLevelLogfile_;                     //!< The debug level for the logfile
    130             int softDebugLevelShell_;                       //!< The debug level for the ingame shell
    131             std::string language_;                          //!< The language
    132             bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
    133             std::string mediaPathString_;                   //!< Path to the data/media file folder as string
    134             bool isDevBuild_;                               //!< True for builds in the build directory (not installed)
    135             bool loaded_;                                   //!< Only true if constructor was interrupted
     56            GameMode();
     57            GameMode(const GameMode& inst);
     58            ~GameMode();
    13659
    13760            static bool bShowsGraphics_s;                   //!< global variable that tells whether to show graphics
     
    14063            static bool bIsStandalone_s;
    14164            static bool bIsMaster_s;
    142 
    143             static Core* singletonRef_s;
    14465    };
    14566}
    14667
    147 #endif /* _Core_H__ */
     68#endif /* _GameMode_H__ */
Note: See TracChangeset for help on using the changeset viewer.