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 
40  static float m_time;
41 
43  unsigned int m_start_time;
44 
47 
49  long long m_num_triangles;
50 
52  long long m_num_culls;
53 
55  long long m_num_solid;
56 
58  long long m_num_transparent;
59 
61  long long m_num_trans_effect;
62 
64  long long m_num_calls;
65 
66 protected:
69  static int m_num_laps;
70 
71  virtual std::shared_ptr<AbstractKart> createKart
72  (const std::string &kart_ident, int index, int local_player_id,
73  int global_player_id, RaceManager::KartType type,
74  HandicapLevel handicap);
75 
76 public:
77  ProfileWorld();
78  virtual ~ProfileWorld();
80  virtual std::string getInternalCode() const {return "PROFILE"; }
81  virtual void update(int ticks);
82  virtual bool isRaceOver();
83  virtual void enterRaceOverState();
84 
85  static void setProfileModeTime(float time);
86  static void setProfileModeLaps(int laps);
87  // ------------------------------------------------------------------------
89  static bool isProfileMode() {return m_profile_mode!=PROFILE_NONE; }
90 };
91 
92 #endif
The main kart class.
Definition: kart.hpp:72
An implementation of World, used for profiling only.
Definition: profile_world.hpp:31
static bool isProfileMode()
Returns true if profile mode was selected.
Definition: profile_world.hpp:89
unsigned int m_start_time
Return value of real time at start of race.
Definition: profile_world.hpp:43
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_trans_effect
Number of transparent effect triangles drawn.
Definition: profile_world.hpp:61
static ProfileType m_profile_mode
If profiling is done, and if so, which mode.
Definition: profile_world.hpp:37
long long m_num_triangles
Number of primitives drawn (in 1000).
Definition: profile_world.hpp:49
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:136
long long m_num_calls
Number of calls to draw.
Definition: profile_world.hpp:64
ProfileType
Profiling modes.
Definition: profile_world.hpp:34
virtual ~ProfileWorld()
Sets profile mode off again.
Definition: profile_world.cpp:67
long long m_num_transparent
Number of transparent triangles drawn.
Definition: profile_world.hpp:58
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
static int m_num_laps
In laps based profiling: number of laps to run.
Definition: profile_world.hpp:69
static void setProfileModeTime(float time)
Enables profiling for a certain amount of time.
Definition: profile_world.cpp:78
long long m_num_solid
Numer of solid triangles drawn.
Definition: profile_world.hpp:55
long long m_num_culls
Number of culled triangles.
Definition: profile_world.hpp:52
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:177
virtual void update(int ticks)
Counts the number of frames.
Definition: profile_world.cpp:155
static void setProfileModeLaps(int laps)
Enables profiling for a certain number of laps.
Definition: profile_world.cpp:90
static float m_time
In time based profiling only: time to run.
Definition: profile_world.hpp:40
virtual std::string getInternalCode() const
Returns identifier for this world.
Definition: profile_world.hpp:80
int m_frame_count
Number of frames.
Definition: profile_world.hpp:46
KartType
Different kart types: A local player, a player connected via network, an AI kart, the leader kart (cu...
Definition: race_manager.hpp:243
Represents a standard race, i.e.
Definition: standard_race.hpp:29
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:43