Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2846 for code/branches/gui/src


Ignore:
Timestamp:
Mar 25, 2009, 6:24:15 PM (16 years ago)
Author:
rgrieder
Message:

Moving game clock from Core to Game.
Other small fixes.

Location:
code/branches/gui/src
Files:
10 edited

Legend:

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

    r2815 r2846  
    102102    }
    103103
    104     Clock* Core::initialise(int argc, char** argv)
    105     {
    106         // Set up a basic clock to keep time
    107         this->gameClock_ = new Clock();
    108 
     104    void Core::initialise(int argc, char** argv)
     105    {
    109106        // Parse command line arguments fist
    110107        try
     
    175172       
    176173        this->loaded_ = true;
    177 
    178         // Return non const pointer to the game's clock for the main loop
    179         return this->gameClock_;
    180174    }
    181175
     
    199193        // Also delete external console command that don't belong to an Identifier
    200194        CommandExecutor::destroyExternalCommands();
    201 
    202         delete this->gameClock_;
    203195
    204196        assert(Core::singletonRef_s);
  • code/branches/gui/src/core/Core.h

    r2807 r2846  
    4545#include "util/OutputHandler.h"
    4646
    47 // Only allow main to access postMainInitialisation, so we need a forward declaration
    48 int main(int, char**);
    4947// boost::filesystem header has quite a large tail, use forward declaration
    5048namespace boost { namespace filesystem
     
    6462            ~Core();
    6563
    66             Clock* initialise(int argc, char** argv);
     64            void initialise(int argc, char** argv);
    6765            void setConfigValues();
    6866
     
    7573            static const std::string& getLanguage();
    7674            static void  resetLanguage();
    77 
    78             static const Clock& getGameClock() { return *getInstance().gameClock_; }
    7975
    8076            static void tsetMediaPath(const std::string& path)
     
    123119            TclThreadManager*     tclThreadManager_;
    124120
    125             Clock*                gameClock_;
    126 
    127121            int softDebugLevel_;                            //!< The debug level
    128122            int softDebugLevelConsole_;                     //!< The debug level for the console
  • code/branches/gui/src/core/Game.cc

    r2845 r2846  
    8686        this->avgTickTime_ = 0.0f;
    8787
     88
     89        // Set up a basic clock to keep time
     90        this->gameClock_ = new Clock();
     91
    8892        this->core_ = new orxonox::Core();
    89         this->gameClock_ = this->core_->initialise(argc, argv);
     93        this->core_->initialise(argc, argv);
    9094
    9195        RegisterRootObject(Game);
     
    104108        for (std::map<std::string, GameState*>::const_iterator it = allStates_s.begin(); it != allStates_s.end(); ++it)
    105109            delete it->second;
     110
     111        delete this->gameClock_;
    106112
    107113        assert(singletonRef_s);
     
    158164
    159165            // UPDATE, bottom to top in the stack
     166            this->core_->update(*this->gameClock_);
    160167            for (std::vector<GameState*>::const_iterator it = this->activeStates_.begin();
    161168                it != this->activeStates_.end(); ++it)
  • code/branches/gui/src/core/Game.h

    r2844 r2846  
    6868        void popState();
    6969
     70        const Clock& getGameClock() { return *this->gameClock_; }
     71
    7072        float getAvgTickTime() { return this->avgTickTime_; }
    7173        float getAvgFPS()      { return this->avgFPS_; }
  • code/branches/gui/src/core/input/KeyBinder.cc

    r2800 r2846  
    4242#include "core/CoreIncludes.h"
    4343#include "core/ConfigFileManager.h"
    44 #include "core/Core.h"
    4544#include "InputCommands.h"
    4645#include "InputManager.h"
  • code/branches/gui/src/network/ChatListener.cc

    r2171 r2846  
    3030
    3131#include "core/CoreIncludes.h"
    32 #include "core/Core.h"
    3332
    3433namespace orxonox
  • code/branches/gui/src/network/ClientConnectionListener.cc

    r2171 r2846  
     1/*
     2 *   ORXONOX - the hottest 3D action shooter ever to exist
     3 *                    > www.orxonox.net <
     4 *
     5 *
     6 *   License notice:
     7 *
     8 *   This program is free software; you can redistribute it and/or
     9 *   modify it under the terms of the GNU General Public License
     10 *   as published by the Free Software Foundation; either version 2
     11 *   of the License, or (at your option) any later version.
     12 *
     13 *   This program is distributed in the hope that it will be useful,
     14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 *   GNU General Public License for more details.
     17 *
     18 *   You should have received a copy of the GNU General Public License
     19 *   along with this program; if not, write to the Free Software
     20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     21 *
     22 *   Author:
     23 *      Oliver Scheuss
     24 *   Co-authors:
     25 *      ...
     26 *
     27 */
     28
    129#include "ClientConnectionListener.h"
    230#include "core/CoreIncludes.h"
  • code/branches/gui/src/orxonox/gamestates/GSClient.cc

    r2844 r2846  
    6262            ThrowException(InitialisationFailed, "Could not establish connection with server.");
    6363
    64         client_->update(Core::getGameClock());
     64        client_->update(Game::getInstance().getGameClock());
    6565    }
    6666
  • code/branches/gui/src/orxonox/gamestates/GSGraphics.cc

    r2844 r2846  
    113113    void GSGraphics::deactivate()
    114114    {
    115         if (Core::showsGraphics())
    116             InputManager::getInstance().requestLeaveState("master");
     115        InputManager::getInstance().requestLeaveState("master");
    117116
    118117        delete this->guiManager_;
     
    129128        delete graphicsManager_;
    130129
    131         if (Core::showsGraphics())
     130        masterInputState_->setHandler(0);
     131        InputManager::getInstance().requestDestroyState("master");
     132        if (this->masterKeyBinder_)
    132133        {
    133             masterInputState_->setHandler(0);
    134             InputManager::getInstance().requestDestroyState("master");
    135             if (this->masterKeyBinder_)
    136             {
    137                 delete this->masterKeyBinder_;
    138                 this->masterKeyBinder_ = 0;
    139             }
     134            delete this->masterKeyBinder_;
     135            this->masterKeyBinder_ = 0;
    140136        }
     137
     138        Core::setShowsGraphics(false);
    141139    }
    142140
  • code/branches/gui/src/orxonox/gamestates/GSRoot.cc

    r2845 r2846  
    115115        uint64_t timeBeforeTick = time.getRealMicroseconds();
    116116
    117         Core::getInstance().update(time);
    118 
    119117        for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it)
    120118            it->tick(time);
Note: See TracChangeset for help on using the changeset viewer.