-
Notifications
You must be signed in to change notification settings - Fork 0
/
TetrisClone.h
46 lines (33 loc) · 1003 Bytes
/
TetrisClone.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
#ifndef TETRISCLONE_H_INCLUDED
#define TETRISCLONE_H_INCLUDED
#include <memory>
#include "GameState.h"
#include "PlayGameState.h"
#include "TitleGameState.h"
#include "ScoreGameState.h"
/* General container and controller for the game */
class TetrisClone
{
private:
static const int fadeDelay = 2;
bool isRunning;
std::unique_ptr<GameState> currentState; // TODO: Implement game state stack
SDL_Event e;
SDL_Renderer* mainRenderer;
int fadeAlpha;
int fadeLastTime;
bool FadeIn();
bool FadeOut();
public:
TetrisClone() { isRunning = false; };
~TetrisClone() { Cleanup(); };
void Init( SDL_Renderer* newRenderer );
void Cleanup();
void HandleEvents();
void Update();
void Render();
bool IsRunning() { return isRunning; };
int max( int n1, int n2 ) { return n1 > n2 ? n1 : n2; }
int min( int n1, int n2 ) { return n1 < n2 ? n1 : n2; }
};
#endif // TETRISCLONE_H_INCLUDED