-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayfield.h
More file actions
54 lines (34 loc) · 1002 Bytes
/
Copy pathplayfield.h
File metadata and controls
54 lines (34 loc) · 1002 Bytes
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
//
// Created by Oliver on 27.03.21.
//
#ifndef PGE_TETRIS_2_PLAYFIELD_H
#define PGE_TETRIS_2_PLAYFIELD_H
#include "olcPixelGameEngine.h"
class Playfield {
public:
Playfield() = default;
explicit Playfield(const olc::vi2d &realPosition);
void Draw(olc::PixelGameEngine *pge);
olc::vi2d BlockToReal(olc::vi2d pos);
void FillBlock(const olc::vi2d &position, olc::Pixel color);
bool IsOccupied(olc::vi2d pos);
void ClearLine(int32_t y);
void CheckForFullLines();
int32_t getScore();
void increaseScore(int32_t amount);
void incrementLinesCleared();
int8_t getLevel();
void incrementLevel();
float getTick();
int32_t getLinesCleared();
private:
olc::vi2d mRealPos;
olc::vi2d mSize = {101, 201};
int8_t mSpace[10][20] = {0};
olc::Pixel mSpaceColor[10][20] = {olc::BLACK};
int32_t mScore = 0;
int8_t mLevel = 0;
int32_t mLinesCleared = 0;
float mTick = 1.0f;
};
#endif //PGE_TETRIS_2_PLAYFIELD_H