|
@ -7,13 +7,22 @@ |
|
|
#define HEIGHT 20 //Höhe Spielfeld |
|
|
#define HEIGHT 20 //Höhe Spielfeld |
|
|
#define PADDLE_LENGTH 4 |
|
|
#define PADDLE_LENGTH 4 |
|
|
#define PADDLE '#' |
|
|
#define PADDLE '#' |
|
|
|
|
|
#define BALL 'O' |
|
|
|
|
|
|
|
|
|
|
|
//Ballstruktur |
|
|
|
|
|
typedef struct { |
|
|
|
|
|
int x; |
|
|
|
|
|
int y; |
|
|
|
|
|
int speedX; |
|
|
|
|
|
int speedY; |
|
|
|
|
|
} Ball; |
|
|
|
|
|
|
|
|
// Bildschirm löschen nach Veränderung Position |
|
|
// Bildschirm löschen nach Veränderung Position |
|
|
void clearScreen() { |
|
|
void clearScreen() { |
|
|
system("clear"); |
|
|
system("clear"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void drawField(int paddle1PositionY, int paddle2PositionY) { |
|
|
|
|
|
|
|
|
void drawField(int paddle1PositionY, int paddle2PositionY, Ball ball) { |
|
|
clearScreen(); |
|
|
clearScreen(); |
|
|
|
|
|
|
|
|
for (int i = 0; i <= HEIGHT; i++){ |
|
|
for (int i = 0; i <= HEIGHT; i++){ |
|
|