Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 3, 2008, 12:20:36 AM (16 years ago)
Author:
rgrieder
Message:
  • moved Tickable to objects again
  • network, audio and core now have their own tick routine
  • Sequence is defined in Orxonox.cc
File:
1 moved

Legend:

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

    r1510 r1524  
    2828
    2929/**
    30     @file CoreSettings.cc
    31     @brief Implementation of the CoreSettings class.
     30    @file Core.cc
     31    @brief Implementation of the Core class.
    3232*/
    3333
    34 #include "CoreSettings.h"
     34#include "Core.h"
    3535#include "Language.h"
    3636#include "CoreIncludes.h"
    3737#include "ConfigValueIncludes.h"
     38#include "input/InputManager.h"
     39#include "TclThreadManager.h"
    3840
    3941namespace orxonox
     
    4345        @param A reference to a global variable, used to avoid an infinite recursion in getSoftDebugLevel()
    4446    */
    45     CoreSettings::CoreSettings()
    46     {
    47         RegisterRootObject(CoreSettings);
     47    Core::Core()
     48    {
     49        RegisterRootObject(Core);
    4850        this->setConfigValues();
    4951    }
     
    5254        @brief Sets the bool to true to avoid static functions accessing a deleted object.
    5355    */
    54     CoreSettings::~CoreSettings()
     56    Core::~Core()
    5557    {
    5658        isCreatingCoreSettings() = true;
     
    5860
    5961    /**
    60         @brief Returns true if the CoreSettings instance is not yet ready and the static functions have to return a default value.
    61     */
    62     bool& CoreSettings::isCreatingCoreSettings()
     62        @brief Returns true if the Core instance is not yet ready and the static functions have to return a default value.
     63    */
     64    bool& Core::isCreatingCoreSettings()
    6365    {
    6466        static bool bCreatingCoreSettings = true;
     
    6769        {
    6870            bFirstTime = false;
    69             CoreSettings::getInstance();
     71            Core::getInstance();
    7072        }
    7173        return bCreatingCoreSettings;
     
    7375
    7476    /**
    75         @brief Returns a unique instance of CoreSettings.
     77        @brief Returns a unique instance of Core.
    7678        @return The instance
    7779    */
    78     CoreSettings& CoreSettings::getInstance()
    79     {
    80         static CoreSettings instance = CoreSettings();
     80    Core& Core::getInstance()
     81    {
     82        static Core instance = Core();
    8183
    8284        // If bCreatingSoftDebugLevelObject is true, we're just about to create an instance of the DebugLevel class
    83         if (CoreSettings::isCreatingCoreSettings())
     85        if (Core::isCreatingCoreSettings())
    8486        {
    8587            isCreatingCoreSettings() = false;
     
    9294        @brief Function to collect the SetConfigValue-macro calls.
    9395    */
    94     void CoreSettings::setConfigValues()
     96    void Core::setConfigValues()
    9597    {
    9698        SetConfigValue(softDebugLevelConsole_, 3).description("The maximal level of debug output shown in the console");
     
    121123        @return The softDebugLevel
    122124    */
    123     int CoreSettings::getSoftDebugLevel(OutputHandler::OutputDevice device)
    124     {
    125         if (!CoreSettings::isCreatingCoreSettings())
     125    int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)
     126    {
     127        if (!Core::isCreatingCoreSettings())
    126128        {
    127129            if (device == OutputHandler::LD_All)
    128                 return CoreSettings::getInstance().softDebugLevel_;
     130                return Core::getInstance().softDebugLevel_;
    129131            else if (device == OutputHandler::LD_Console)
    130                 return CoreSettings::getInstance().softDebugLevelConsole_;
     132                return Core::getInstance().softDebugLevelConsole_;
    131133            else if (device == OutputHandler::LD_Logfile)
    132                 return CoreSettings::getInstance().softDebugLevelLogfile_;
     134                return Core::getInstance().softDebugLevelLogfile_;
    133135            else if (device == OutputHandler::LD_Shell)
    134                 return CoreSettings::getInstance().softDebugLevelShell_;
     136                return Core::getInstance().softDebugLevelShell_;
    135137        }
    136138
     
    144146        @param level The level
    145147    */
    146      void CoreSettings::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
     148     void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
    147149     {
    148         if (!CoreSettings::isCreatingCoreSettings())
     150        if (!Core::isCreatingCoreSettings())
    149151        {
    150152            if (device == OutputHandler::LD_All)
    151                 CoreSettings::getInstance().softDebugLevel_ = level;
     153                Core::getInstance().softDebugLevel_ = level;
    152154            else if (device == OutputHandler::LD_Console)
    153                 CoreSettings::getInstance().softDebugLevelConsole_ = level;
     155                Core::getInstance().softDebugLevelConsole_ = level;
    154156            else if (device == OutputHandler::LD_Logfile)
    155                 CoreSettings::getInstance().softDebugLevelLogfile_ = level;
     157                Core::getInstance().softDebugLevelLogfile_ = level;
    156158            else if (device == OutputHandler::LD_Shell)
    157                 CoreSettings::getInstance().softDebugLevelShell_ = level;
     159                Core::getInstance().softDebugLevelShell_ = level;
    158160        }
    159161     }
     
    162164        @brief Returns the configured language.
    163165    */
    164     const std::string& CoreSettings::getLanguage()
    165     {
    166         if (!CoreSettings::isCreatingCoreSettings())
    167             return CoreSettings::getInstance().language_;
     166    const std::string& Core::getLanguage()
     167    {
     168        if (!Core::isCreatingCoreSettings())
     169            return Core::getInstance().language_;
    168170
    169171        return Language::getLanguage().defaultLanguage_;
     
    173175        @brief Sets the language in the config-file back to the default.
    174176    */
    175     void CoreSettings::resetLanguage()
    176     {
    177         CoreSettings::getInstance().resetLanguageIntern();
     177    void Core::resetLanguage()
     178    {
     179        Core::getInstance().resetLanguageIntern();
    178180    }
    179181
     
    181183        @brief Sets the language in the config-file back to the default.
    182184    */
    183     void CoreSettings::resetLanguageIntern()
     185    void Core::resetLanguageIntern()
    184186    {
    185187        ResetConfigValue(language_);
     188    }
     189
     190    /**
     191        @brief Ticks every core class in a specified sequence. Has to be called
     192               every Orxonox tick!
     193        @param dt Delta Time
     194    */
     195    void Core::tick(float dt)
     196    {
     197        TclThreadManager::getInstance().tick(dt);
     198        InputManager::tick(dt);
    186199    }
    187200}
     
    193206int getSoftDebugLevel()
    194207{
    195     return orxonox::CoreSettings::getSoftDebugLevel();
     208    return orxonox::Core::getSoftDebugLevel();
    196209}
Note: See TracChangeset for help on using the changeset viewer.