-
Notifications
You must be signed in to change notification settings - Fork 0
/
gameboard.h
51 lines (40 loc) · 1.06 KB
/
gameboard.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
#ifndef GAMEBOARD_H
#define GAMEBOARD_H
#include <array>
#include "SDL.h"
#include "rect.h"
#include "gametext.h"
#define GB_MAX_X 10
#define GB_MAX_Y 22
enum GB_TEXTS {
GBT_SCORE=0,
GBT_LINES,
GBT_LEVEL
};
class Gameboard
{
private:
std::array<std::array<Rect,GB_MAX_X>, GB_MAX_Y> gb;
twoD offset;
int score = 0;
int lines_cleared = 0;
int level = 0;
std::vector<GameText> texts;
//tscore, tlevel, tlines;
void initText(Font *f);
public:
Gameboard(Font *f);
Gameboard(Font *f, twoD &toff);
void setOffset(twoD &toff);
void setRectOffset(twoD &toff);
bool setRect(int gb_x, int gb_y, color & tc, bool movable);
bool setGhostRect(int gb_x, int gb_y);
bool resetRect(int gb_x, int gb_y);
bool checkRect(int gb_x, int gb_y);
bool checkLines();
void applyGravity(int line);
void prepareText(SDL_Renderer *renderer);
bool Draw(SDL_Renderer *srend);
void Reset();
};
#endif // GAMEBOARD_H