Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 21, 2009, 10:17:59 PM (15 years ago)
Author:
rgrieder
Message:

Removed GameState template and renamed GameStateBase to GameState.
Moved statistics stuff (fps and tick time) to Game and removed the remaining hacks in GSGraphics and GSRoot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/Game.h

    r2807 r2817  
    3838#include "OrxonoxPrereqs.h"
    3939#include <cassert>
    40 #include "core/CorePrereqs.h"
     40#include <list>
     41#include "core/OrxonoxClass.h"
    4142
    4243namespace orxonox
     
    4647        Main class responsible for running the game.
    4748    */
    48     class _OrxonoxExport Game
     49    class _OrxonoxExport Game : public OrxonoxClass
    4950    {
    5051    public:
    5152        Game(int argc, char** argv);
    5253        ~Game();
     54        void setConfigValues();
    5355
    5456        void run();
    5557        void stop();
    5658
     59        float getAvgTickTime() { return this->avgTickTime_; }
     60        float getAvgFPS()      { return this->avgFPS_; }
     61
     62        void addTickTime(uint32_t length);
     63
    5764        static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
    5865
    5966    private:
     67        struct statisticsTickInfo
     68        {
     69            uint64_t    tickTime;
     70            uint32_t    tickLength;
     71        };
     72
    6073        Game(Game&); // don't mess with singletons
    6174
     
    6578        bool abort_;
    6679
     80        // variables for time statistics
     81        uint64_t              statisticsStartTime_;
     82        std::list<statisticsTickInfo>
     83                              statisticsTickTimes_;
     84        uint32_t              periodTime_;
     85        uint32_t              periodTickTime_;
     86        float                 avgFPS_;
     87        float                 avgTickTime_;
     88
     89        // config values
     90        unsigned int          statisticsRefreshCycle_;
     91        unsigned int          statisticsAvgLength_;
     92
    6793        static Game* singletonRef_s;        //!< Pointer to the Singleton
    6894    };
Note: See TracChangeset for help on using the changeset viewer.