SuperTuxKart
profile_world.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2009-2015 Joerg Henrichs
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef HEADER_PROFILE_WORLD_HPP
20 #define HEADER_PROFILE_WORLD_HPP
21 
22 #include "modes/standard_race.hpp"
23 
24 class Kart;
25 
30 class ProfileWorld : public StandardRace
31 {
32 private:
34  enum ProfileType {PROFILE_NONE, PROFILE_TIME, PROFILE_LAPS};
35 
38 
41  static bool m_no_graphics;
42 
44  static float m_time;
45 
47  unsigned int m_start_time;
48 
51 
53  long long m_num_triangles;
54 
56  long long m_num_culls;
57 
59  long long m_num_solid;
60 
62  long long m_num_transparent;
63 
65  long long m_num_trans_effect;
66 
68  long long m_num_calls;
69 
70 protected:
73  static int m_num_laps;
74 
75  virtual std::shared_ptr<AbstractKart> createKart
76  (const std::string &kart_ident, int index, int local_player_id,
77  int global_player_id, RaceManager::KartType type,
78  HandicapLevel handicap);
79 
80 public:
81  ProfileWorld();
82  virtual ~ProfileWorld();
84  virtual std::string getInternalCode() const {return "PROFILE"; }
85  virtual void update(int ticks);
86  virtual bool isRaceOver();
87  virtual void enterRaceOverState();
88 
89  static void setProfileModeTime(float time);
90  static void setProfileModeLaps(int laps);
91  // ------------------------------------------------------------------------
93  static bool isProfileMode() {return m_profile_mode!=PROFILE_NONE; }
94  // ------------------------------------------------------------------------
96  static void disableGraphics() { m_no_graphics = true; }
97  // ------------------------------------------------------------------------
99  static bool isNoGraphics() {return m_no_graphics; }
100 };
101 
102 #endif
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:39
The main kart class.
Definition: kart.hpp:68
long long m_num_triangles
Number of primitives drawn (in 1000).
Definition: profile_world.hpp:53
static bool isProfileMode()
Returns true if profile mode was selected.
Definition: profile_world.hpp:93
virtual void update(int ticks)
Counts the number of frames.
Definition: profile_world.cpp:154
static void disableGraphics()
Switches off graphics.
Definition: profile_world.hpp:96
static void setProfileModeTime(float time)
Enables profiling for a certain amount of time.
Definition: profile_world.cpp:78
long long m_num_calls
Number of calls to draw.
Definition: profile_world.hpp:68
KartType
Different kart types: A local player, a player connected via network, an AI kart, the leader kart (cu...
Definition: race_manager.hpp:236
An implementation of World, used for profiling only.
Definition: profile_world.hpp:30
static float m_time
In time based profiling only: time to run.
Definition: profile_world.hpp:44
static bool isNoGraphics()
Returns true if no graphics should be displayed.
Definition: profile_world.hpp:99
static bool m_no_graphics
If no graphics should be displayed.
Definition: profile_world.hpp:41
virtual std::string getInternalCode() const
Returns identifier for this world.
Definition: profile_world.hpp:84
static void setProfileModeLaps(int laps)
Enables profiling for a certain number of laps.
Definition: profile_world.cpp:90
unsigned int m_start_time
Return value of real time at start of race.
Definition: profile_world.hpp:47
virtual ~ProfileWorld()
Sets profile mode off again.
Definition: profile_world.cpp:67
static int m_num_laps
In laps based profiling: number of laps to run.
Definition: profile_world.hpp:73
static ProfileType m_profile_mode
If profiling is done, and if so, which mode.
Definition: profile_world.hpp:37
long long m_num_transparent
Number of transparent triangles drawn.
Definition: profile_world.hpp:62
Represents a standard race, i.e.
Definition: standard_race.hpp:28
ProfileType
Profiling modes.
Definition: profile_world.hpp:34
long long m_num_culls
Number of culled triangles.
Definition: profile_world.hpp:56
long long m_num_trans_effect
Number of transparent effect triangles drawn.
Definition: profile_world.hpp:65
virtual bool isRaceOver()
The race is over if either the requested number of laps have been done or the requested time is over.
Definition: profile_world.cpp:135
virtual void enterRaceOverState()
This function is called when the race is finished, but end-of-race animations have still to be played...
Definition: profile_world.cpp:176
int m_frame_count
Number of frames.
Definition: profile_world.hpp:50
ProfileWorld()
The constructor sets the number of (local) players to 0, since only AI karts are used.
Definition: profile_world.cpp:43
long long m_num_solid
Numer of solid triangles drawn.
Definition: profile_world.hpp:59
virtual std::shared_ptr< AbstractKart > createKart(const std::string &kart_ident, int index, int local_player_id, int global_player_id, RaceManager::KartType type, HandicapLevel handicap)
Creates a kart, having a certain position, starting location, and local and global player id (if appl...
Definition: profile_world.cpp:108