source: golgotha/src/golg/statistics.hh

Last change on this file was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 1.8 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef _STATISTICS_HH_
10#define _STATISTICS_HH_
11
12#include "arch.hh"
13#include "math/num_type.hh"
14#include "time/time.hh"
15
16class i4_parent_window_class;
17
18class g1_statistics_counter_class
19{
20
21public:
22  enum {TOTAL_POLYS, OBJECT_POLYS, TERRAIN_POLYS,OBJECTS,
23        TERRAIN, SPRITES, SFXS, FRAMES, LAST};
24
25  sw32 counter_array[LAST];
26  w32 current_counter;
27  w32 t_frames;
28 
29  i4_time_class last_update_time;
30 
31  w32 get_value(w32 count_type)
32  {
33    if (count_type<LAST)
34      return counter_array[count_type];
35    else
36      return 0;
37  }
38 
39  void set_value(w32 count_type, w32 value)
40  {
41    if (count_type<LAST)
42      counter_array[count_type] = value;   
43  }
44
45  void set_current_counter(w32 count_type)
46  {
47    current_counter = count_type;
48  }
49
50  w32 get_current_counter()
51  {
52    return current_counter;
53  }
54
55  void increment_current_counter()
56  {
57    if (current_counter<LAST)
58      counter_array[current_counter]++;
59  }
60
61  void increment(w32 inc)
62  {
63    if (inc<LAST)
64      counter_array[inc]++;
65  }
66
67  void add(w32 inc, w32 amount)
68  {
69    if (inc<LAST)
70      counter_array[inc] += amount;
71  }
72
73  void reset()
74  {
75    w32 i;
76    for (i=0;i<LAST;i++)
77      counter_array[i] = 0;
78
79    t_frames=0;
80    last_update_time.get();
81  }
82
83  void show();
84};
85
86extern g1_statistics_counter_class g1_stat_counter;
87
88#endif
Note: See TracBrowser for help on using the repository browser.