1 #ifndef _game_h
2 #define _game_h
3 
4 #ifndef _vec2_h
5 #	include "vec2.h"
6 #endif
7 
8 #ifndef _keeper_h
9 #	include "keeper.h"		// for inlines
10 #endif
11 
12 class Ball;
13 class XWall;
14 class YWall;
15 
16 class Game {
17 	public:
18 		Game(double wx=100., double wy=80.);
19 		virtual ~Game();
20 
21 		virtual const Real & GetPresetA()				const;
22 		virtual const Real & GetPresetHaft()			const;
23 		virtual const Real & GetSlowGranularity()		const;
24 		virtual const Real & GetNormalBallSize() 		const;
25 
26 		virtual const Real& GetChargeGranularity()	const;
27 		virtual const Real& GetChargeSpeed()			const;
28 		virtual const Real& GetMaxCharge()				const;
29 		virtual const Real& GetShootTime()				const;
30 
31 		virtual const Real AreaOffX() const   = 0;
32 		virtual const Real AreaOffY() const   = 0;
33 		virtual const Real AreaWidth() const  = 0;
34 		virtual const Real AreaHeight() const = 0;
35 		Vec2 Edge( int i ) const;
36 		Vec2 Mid( int i ) const;
37 
38 		virtual void InitPlayground();
39 		virtual void DrawBackground() const;
40 
41 		void ExposeRedraw() const;
42 		void ResizeRedraw() const;
43 
44 		void ShowInfo( char *str ) const;
ShowInfoIf(char * str)45 		void ShowInfoIf( char *str ) const {
46 #			ifdef DEBUG
47 				if (debug&GameState)
48 #			endif
49 						ShowInfo(str);
50 		}
51 
52 		virtual void ResetGame();
53 
54 		virtual void ShootBall( Ball *b );
55 		virtual void PressedBall( Ball *b );
56 		virtual void TouchedBall( Ball *b );
57 		virtual void HitWall( Ball *b );
58 		virtual void StartBall( Ball *b );
59 		virtual void StopBall( Ball *b );
60 		virtual void InPocket( Ball *b );
61 		virtual void AllBallsStopped();
62 
63 		virtual int  IsSelectable( Ball *B );
64 
65 	// Durchreichen der Keeper-Funktionalitaet
TakeOffBoard(Ball * b)66 		void TakeOffBoard(Ball *b)		{ keeper->TakeOffBoard(b); }
67 
68 	protected:
69 		ColorId	floor;
70 
71 		Keeper	*keeper;
72 
73 	private:
74 		int	running_balls;
75 friend class PBallNorm;
76 
77 	public:
78 		static Real PresetA;
79 		static Real PresetHaft;
80 		static Real SlowGranularity;
81 		static Real NormalBallSize;
82 
83 		static Real	ChargeGranularity;	// L�nge eines Ladeschritts
84 		static Real ChargeSpeed;			// Einheiten pro Sekunde (Aufladen)
85 		static Real	MaxCharge;				// maximale Ladung
86 		static Real ShootTime;				// Zeit der Entladeanimation
87 
88 
89 		XWall	*x1, *x2;
90 		YWall	*y1, *y2;
91 
92 #ifdef __TURBOC__
93 		void *buffer;
94 #endif
95 };
96 
97 extern Game	*g;
98 
99 #endif
100