File: game.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 (99 lines) | stat: -rw-r--r-- 2,204 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
#ifndef _game_h
#define _game_h

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

#ifndef _keeper_h
#	include "keeper.h"		// for inlines
#endif

class Ball;
class XWall;
class YWall;

class Game {
	public:
		Game(double wx=100., double wy=80.);
		virtual ~Game();

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

		virtual const Real& GetChargeGranularity()	const;
		virtual const Real& GetChargeSpeed()			const;
		virtual const Real& GetMaxCharge()				const;
		virtual const Real& GetShootTime()				const;

		virtual const Real AreaOffX() const   = 0;
		virtual const Real AreaOffY() const   = 0;
		virtual const Real AreaWidth() const  = 0;
		virtual const Real AreaHeight() const = 0;
		Vec2 Edge( int i ) const;
		Vec2 Mid( int i ) const;

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

		void ExposeRedraw() const;
		void ResizeRedraw() const;

		void ShowInfo( char *str ) const;
		void ShowInfoIf( char *str ) const {
#			ifdef DEBUG
				if (debug&GameState)
#			endif
						ShowInfo(str);
		}

		virtual void ResetGame();

		virtual void ShootBall( Ball *b );
		virtual void PressedBall( Ball *b );
		virtual void TouchedBall( Ball *b );
		virtual void HitWall( Ball *b );
		virtual void StartBall( Ball *b );
		virtual void StopBall( Ball *b );
		virtual void InPocket( Ball *b );
		virtual void AllBallsStopped();

		virtual int  IsSelectable( Ball *B );

	// Durchreichen der Keeper-Funktionalitaet
		void TakeOffBoard(Ball *b)		{ keeper->TakeOffBoard(b); }

	protected:
		ColorId	floor;

		Keeper	*keeper;

	private:
		int	running_balls;
friend class PBallNorm;

	public:
		static Real PresetA;
		static Real PresetHaft;
		static Real SlowGranularity;
		static Real NormalBallSize;

		static Real	ChargeGranularity;	// L´┐Żnge eines Ladeschritts
		static Real ChargeSpeed;			// Einheiten pro Sekunde (Aufladen)
		static Real	MaxCharge;				// maximale Ladung
		static Real ShootTime;				// Zeit der Entladeanimation


		XWall	*x1, *x2;
		YWall	*y1, *y2;

#ifdef __TURBOC__
		void *buffer;
#endif
};

extern Game	*g;

#endif