-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPong.h
66 lines (62 loc) · 1.54 KB
/
Pong.h
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
// Copyright Milan Oberkirch
// <[email protected]>
#ifndef PROJEKT_PONG_H_
#define PROJEKT_PONG_H_
#include <stdio.h>
#include <stdlib.h>
#include <gtest/gtest.h>
#include "./Pad.h"
#include "./Bat.h"
#include "./Ball.h"
// Main class for the pong-game |· |
class Pong
{
public:
// Constructor (uses init to set all standart values)
Pong();
// Destructor
~Pong() { }
// set all standart values
void Init(
int relativeSpeed,
int batSize,
int pointsToWin,
char ballTrace,
int speedup,
bool bell);
FRIEND_TEST(PongTest, Init);
// run the programm (this function takes care of events and maks sure that
// changes to the window are drawed one after another)
void Run();
// redraw everything (runs all Draw Functions of the sub-classes)
void Draw();
// prints Usage while pausing the Programm (if unknown key is pressed)
void printUsageAndPause();
// print final score and ask for replay
void Win();
private:
// check for events and call the right function for the detected event
void Event();
void HandleKeyEvents();
void HandleBallEvents();
void JumpBatIfOut(Bat *bat);
void IsBallAtLeftBat();
void IsBallAtRightBat();
void bell();
// the pad is responsible for drawing the window and setting counters
friend void Bat::Draw();
Pad _pad;
// the bats
Bat _batLeft;
Bat _batRight;
// the ball
Ball _ball;
// Initial parameters
int _relativeSpeed;
int _batSize;
int _pointsToWin;
char _ballTrace;
int _speedup;
bool _bell;
};
#endif // PROJEKT_PONG_H_