File: hockey.h

package info (click to toggle)
flying 6.20-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 752 kB
  • ctags: 1,873
  • sloc: cpp: 10,966; makefile: 189
file content (107 lines) | stat: -rw-r--r-- 1,999 bytes parent folder | download | duplicates (4)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef _hockey_h
#define _hockey_h

#ifndef _vec2_h
#	include "vec2.h"
#endif
#ifndef _game_h
#	include "game.h"
#endif

class BallMover;		// forward
class Goal;
class StaticBall;
class Wall;

class Hockey : public Game {
	public:
		static Real	TableWidth;
		static Real TableHeight;

		Hockey(double wx=TableWidth, double wy=TableHeight);
		virtual ~Hockey();

		virtual const Real & GetPresetA() const;
		virtual const Real & GetPresetHaft() const;
		virtual const Real & GetSlowGranularity() const;

		virtual const Real & GetNormalBallSize() const;

		virtual const Real AreaOffX() const;
		virtual const Real AreaOffY() const;
		virtual const Real AreaWidth() const;
		virtual const Real AreaHeight() const;

		virtual void InitPlayground();
		virtual void DrawBackground() const;

		void InitArea( double wx, double wy );
		void InitTable();

		virtual void InPocket( Ball *b );
		virtual void StopBall( Ball *b );

		static Real PresetA;
		static Real PresetHaft;
		static Real SlowGranularity;

		static Real FrameOffset;
		static Real GoalSize;

		static Real DiscRadius;
		static Real HandRadius;
		static Real DiscWeight;
		static Real HandWeight;

		static Real	GoalFrame;
		static Real GoalHeight;

	protected:
		Real area_off_x;
		Real area_off_y;
		Real area_width;
		Real area_height;

		BallMover	*mdisc;
		BallMover	*mhand;

		ColorId		table_col;
		ColorId		table_dark_col;
		ColorId		red_bg_col;
		ColorId		blue_bg_col;

		ColorId		disc_col;
		ColorId		hand_col;

	protected:
		Vec2		mid;
		Vec2		edge[4];
		Goal			*goal[2];
		StaticBall	*post[2][2];
		Wall			*w[2][3];

		int			disc_in_goal;
		Ball			*disc;
		Ball			*hand1, *hand2;
};

class TestHockey : public Hockey {
	public:
		TestHockey(double speed=100.0);
		virtual ~TestHockey();

		virtual const Real &GetPresetA() const;
		virtual const Real &GetSlowGranularity() const;

		virtual void InitPlayground();

		static Real	PresetA;
		static Real	SlowGranularity;

	private:
		Real	shot_speed;

		Wall	*w[4];
};

#endif