Recast Navigation
Navigation-mesh Toolset for Games
ValueHistory.h
Go to the documentation of this file.
1 #ifndef VALUEHISTORY_H
2 #define VALUEHISTORY_H
3 
5 {
6  static const int MAX_HISTORY = 256;
7  float m_samples[MAX_HISTORY];
8  int m_hsamples;
9 public:
10  ValueHistory();
11 
12  inline void addSample(const float val)
13  {
14  m_hsamples = (m_hsamples+MAX_HISTORY-1) % MAX_HISTORY;
15  m_samples[m_hsamples] = val;
16  }
17 
18  inline int getSampleCount() const
19  {
20  return MAX_HISTORY;
21  }
22 
23  inline float getSample(const int i) const
24  {
25  return m_samples[(m_hsamples+i) % MAX_HISTORY];
26  }
27 
28  float getSampleMin() const;
29  float getSampleMax() const;
30  float getAverage() const;
31 };
32 
34 {
35  void setRect(int ix, int iy, int iw, int ih, int ipad);
36  void setValueRange(float ivmin, float ivmax, int indiv, const char* iunits);
37 
38  int x, y, w, h, pad;
39  float vmin, vmax;
40  int ndiv;
41  char units[16];
42 };
43 
44 void drawGraphBackground(const GraphParams* p);
45 
46 void drawGraph(const GraphParams* p, const ValueHistory* graph,
47  int idx, const char* label, const unsigned int col);
48 
49 
50 #endif // VALUEHISTORY_H
51 
void drawGraph(const GraphParams *p, const ValueHistory *graph, int idx, const char *label, const unsigned int col)
Definition: ValueHistory.cpp:82
void drawGraphBackground(const GraphParams *p)
Definition: ValueHistory.cpp:60
Definition: ValueHistory.h:5
int getSampleCount() const
Definition: ValueHistory.h:18
ValueHistory()
Definition: ValueHistory.cpp:10
void addSample(const float val)
Definition: ValueHistory.h:12
float getSampleMin() const
Definition: ValueHistory.cpp:17
float getSampleMax() const
Definition: ValueHistory.cpp:26
float getSample(const int i) const
Definition: ValueHistory.h:23
float getAverage() const
Definition: ValueHistory.cpp:35
Definition: ValueHistory.h:34
void setRect(int ix, int iy, int iw, int ih, int ipad)
Definition: ValueHistory.cpp:43
int pad
Definition: ValueHistory.h:38
float vmin
Definition: ValueHistory.h:39
int ndiv
Definition: ValueHistory.h:40
void setValueRange(float ivmin, float ivmax, int indiv, const char *iunits)
Definition: ValueHistory.cpp:52
int x
Definition: ValueHistory.h:38
float vmax
Definition: ValueHistory.h:39
int h
Definition: ValueHistory.h:38
char units[16]
Definition: ValueHistory.h:41
int y
Definition: ValueHistory.h:38
int w
Definition: ValueHistory.h:38