-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.h
56 lines (42 loc) · 1.51 KB
/
game.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
#ifndef _GAME
#define _GAME
// ------ Includes -----
#include "board.h"
#include "blocks.h"
#include "IO.h"
#include <time.h>
#include <string>
// ------ Defines -----
#define BASIC_SCORE 10
// --------------------------------------------------------------------------------
// Game
// --------------------------------------------------------------------------------
class Game {
public:
Game (Board *pBoard, Blocks *pBlocks, IO *pIO, int pScreenHeight);
void DrawScene ();
bool CreateNewBlock ();
int GetScore ();
void SetScore (int lines);
int GetLevel ();
void SetLevel (int total_lines);
int GetWaitTime ();
void SetWaitTime ();
int posX, posY; // Position of the block that is falling down
int block, bRotation; // Type and rotation the block that is falling down
private:
int level{ 1 }; //Level
int waitTime{ 700 }; //The wait time before the block going down 1 cell
int score{ 0 }; // Score
int mScreenHeight; // Screen height in pixels
int nextPosX, nextPosY; // Position of the next piece
int nextBlock, nextRotation; // Type and rotation of the next piece
Board *mBoard;
Blocks *mBlock;
IO *mIO;
int GetRand (int pA, int pB);
void InitGame ();
void DrawBlock (int pX, int pY, int block, int bRotation);
void DrawBoard ();
};
#endif // _GAME