File: snooker.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 (67 lines) | stat: -rw-r--r-- 1,345 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
#ifndef _snooker_h
#define _snooker_h

#ifndef _vec2_h
#	include "vec2.h"
#endif
#ifndef _pool_h
#	include "pool.h"
#endif

class Snooker : public Pool {
	public:
		static Real TableWidth;
		static Real TableHeight;
		static Real BallRadius;

		Snooker(double dx=TableWidth, double dy=TableHeight);
		virtual ~Snooker();

		virtual void InitPlayground();
		virtual void DrawBackground() const;
		virtual void ResetGame();
		virtual const Real & GetNormalBallSize() const;

		ColorId		red_col;
		ColorId		cols[6];

		virtual void InPocket( Ball *b );
		virtual void AllBallsStopped();
		virtual int  IsSelectable( Ball *b );

	protected:

		void SetupBalls();
		void Triangle( double x, double y );
		void Triangle( const Vec2 &v )	{ Triangle(v.X(),v.Y()); }

		Ball	*red[15];
		Ball	*colored[6];

		Vec2	reddefs[15];	// Positionen der roten Kugeln
		Vec2	defs[6];			// Default-Positionen der Farben

		int	reds_in_pocket;
		int	color_in_pocket;
};

class SnookerDemo : public Snooker {
	public:
		SnookerDemo( double s=100.0 ) : shot_speed(s)	{}
		virtual ~SnookerDemo();

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

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

	private:
		Real			shot_speed;

	public:
		static Real	PresetA;
		static Real	SlowGranularity;
};

#endif