-
Notifications
You must be signed in to change notification settings - Fork 0
/
Manager.h
103 lines (74 loc) · 2.33 KB
/
Manager.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef TETRIS_GAME_MANAGER
#define TETRIS_GAME_MANAGER
//INCLUSIONS
#include "PiecesContainer.h"
#include "Plotter.h"
#include "PlotterTetris.h"
class Manager
{
public:
Manager();
/*****Basic Game Functionality*****/
bool step();
void draw();
bool move(int);
void setSpeed(const int& amount)
{
options_.speedLevel_ = amount;
options_.speedSetting_.handleSpeedSettings(amount);
}
/*****Used to Communicate with Game.h*******/
GameStat& returnGameStat();
//Set up screen functions
void setUpScreen();
void readySetGo();
void drawTetrisLarge(int x, int y);
void justWait(double seconds);
void drawOutline (int xStart, int xEnd, int yStart, int yEnd);
void gameOver();
/******Game Options(see HeaderStuff.h)******/ //(It's here so game can mess with it, but not user)
Options options_;
private:
/********The Guts*********/
PlotterTetris plotHUD_;
Plotter plotPlayField_, plotNext_;
Matrix playField_, nextPiece_;
//Pieces Contained for Game
PiecesContainer container_;
/******The Pieces Immediatley concerned with the Game*****/
Piece* pInAction_, *pNextAction_;
/*******Flags**********/
bool pieceHitRockBottom_;
bool moveDown();
/******Game Statistics(see HeaderStuff.h)******/
GameStat statistic_;
void updateScore(int);
/*******Private Helper Functions******/
//used in step() --instantiating new piece
Piece* giveNewRandomPiece();
//used in step() --move active piece into playField or impossible
bool moveActiveToPlayField(Piece &p);
/*Piece Fuctions for Move()*/
void flip();
void moveRight();
void moveLeft();
bool gravity();
/*playField handling functions*/
void updatePlayField(PiecesContainer*);
void displayDeletionRows(void);
void displayDeletionUpdatePlayField(PiecesContainer*);
void fillFieldWithEmpty(void);
void destroyRowCompletions(void);
void checkAllOfContainerToRowDelete( PiecesContainer&, const int );
void movePiecesDown (PiecesContainer&, const int);
void checkThatFieldEmpty();
void drawNextPiece (Piece*);
void colorChangeAllBlocks(int amount = 1);
/*Helper Function for Move Actions in General*/
bool isAPartOfActive(int, int);
/*Tme Helper Function*/
void wait( double);
/*KeyLogging Helper*/
void checkKeyLog( int& );
};
#endif