-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.h
84 lines (53 loc) · 1.38 KB
/
Board.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// Created by Daniel Eidlin on 17/07/2020.
//
#ifndef SNAKE_BOARD_H
#define SNAKE_BOARD_H
#include <curses.h>
#include "Snake.h"
#include "Item.h"
#include "SoundController.h"
#include "DioItem.h"
class Board {
private:
int height;
int width;
char border_sign;
WINDOW *fieldWin;
WINDOW *scoreWin;
Snake snake;
Item apple;
DioItem dioItem;
int score;
static const int SNAKE_PAIR, APPLE_PAIR;
SoundController appleSoundController = SoundController("../sound/apple.wav");
SoundController dioSoundController = SoundController("../sound/dio.wav");
bool playAppleSound;
bool playDioSound;
bool dioEffect;
public:
Board(int height, int width, char border_sign = '*');
~Board();
std::pair<int, int> generateRandomCoordinates() const;
void initializeSnake();
void initializeApple();
void initializeDioItem();
void initializeWindows();
void initializeColors() const;
void eraseLastDrawings() const;
void drawSnakeBody() const;
void drawSnakeHead() const;
void drawApple() const;
void drawDioItem() const;
void playSounds();
void draw();
void getInput();
Snake &getSnake();
bool snakeCollided() const;
void checkAppleEngage();
void endGame();
void activateDioItem();
void checkDioEngage();
bool isDioEffect() const;
};
#endif //SNAKE_BOARD_H