File: EndGameBox.h

package info (click to toggle)
spring 0.81.2.1%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,496 kB
  • ctags: 37,096
  • sloc: cpp: 238,659; ansic: 13,784; java: 12,175; awk: 3,428; python: 1,159; xml: 738; perl: 405; sh: 297; makefile: 267; pascal: 228; objc: 192
file content (83 lines) | stat: -rw-r--r-- 1,511 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef __END_GAME_BOX_H__
#define __END_GAME_BOX_H__

#include "InputReceiver.h"
#include <list>
#include <vector>
#include "Rendering/GL/myGL.h"
#include "Rendering/Textures/Bitmap.h"


// msvc behaves really strange
#if _MSC_VER
namespace std {
	using ::fabs;
	using ::floor;
}
#endif

class CEndGameBox :
	public CInputReceiver
{
public:
	CEndGameBox(void);
	~CEndGameBox(void);

	virtual bool MousePress(int x, int y, int button);
	virtual void MouseMove(int x, int y, int dx,int dy, int button);
	virtual void MouseRelease(int x, int y, int button);
	virtual void Draw();
	virtual bool IsAbove(int x, int y);
	virtual std::string GetTooltip(int x,int y);

	static bool disabled;

protected:
	void FillTeamStats();
	ContainerBox box;

	ContainerBox exitBox;

	ContainerBox playerBox;
	ContainerBox sumBox;
	ContainerBox difBox;

	bool moveBox;

	int dispMode;

	int stat1;
	int stat2;

	struct TeamStat {
	};

	struct Stat {
		Stat(std::string s) : name(s),max(1),maxdif(1){}

		void AddStat(int team,float value){
			if (value>max) {
				max=value;
			}
			if (team >= 0 && static_cast<size_t>(team) >= values.size()) {
				values.resize(team+1);
			}
			if (values[team].size()>0 && fabs(value-values[team].back())>maxdif) {
				maxdif = fabs(value-values[team].back());
			}

			values[team].push_back(value);
		}
		std::string name;
		float max;
		float maxdif;

		std::vector< std::vector<float> > values;
	};

	std::vector<Stat> stats;
	GLuint graphTex;
	CBitmap bm;
};

#endif // __END_GAME_BOX_H__