Back to index

extremetuxracer  0.5beta
bench.h
Go to the documentation of this file.
00001 /* 
00002  * PPRacer 
00003  * Copyright (C) 2004-2005 Volker Stroebel <volker@planetpenguin.de>
00004  * 
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 
00021 #ifndef _BENCH_H_
00022 #define _BENCH_H_
00023 
00024 #include "loop.h"
00025 
00026 #include "ppgltk/alg/vec2d.h"
00027 
00028 #include <string>
00029 
00030 
00031 class Benchmark : public GameMode
00032 {      
00033        static std::string sm_course;
00034        static double sm_frames;
00035        static double sm_oldFrames;
00036        static int sm_framesCounter;
00037        static int sm_maxFrames;
00038        static int sm_fc;
00039        static pp::Vec2d sm_pos;
00040        static double sm_timeStep;
00041        static race_conditions_t sm_condition;
00042        
00043 public:
00044        Benchmark();
00045        ~Benchmark();
00046 
00047        void loop(float timeStep);
00048 
00049        typedef enum{
00050               NONE=0,
00051               AUTO=1,
00052               DEMO,
00053               PAUSED        
00054        }mode_t;
00055 
00056        static void setCourse(const char* course);
00057        static void setMaxTime(double time);
00058        static void setMaxFrames(int frames);
00059        static void setPosition(pp::Vec2d &position);
00060        static pp::Vec2d& getPosition(); 
00061        static Benchmark::mode_t getMode();
00062        static void setMode(Benchmark::mode_t);
00063        static void setTimeStep(double timeStep);
00064        static double getTimeStep(); 
00065        static void setRaceCondition(int condition);
00066 
00067        static void updateFPS(double fps);
00068        static void displayState();
00069        
00070 private:
00071        static mode_t sm_mode;
00072 
00073 };
00074 
00075 #endif // _BENCH_H_