-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.h
More file actions
71 lines (54 loc) · 1.76 KB
/
Copy pathGame.h
File metadata and controls
71 lines (54 loc) · 1.76 KB
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
#pragma once
class Game
{
private:
static const uint8_t _NUM_HIGHSCORE = 5; // Number of highscores to keep
static const uint8_t _NAME_LENGTH = 12; // Lenght of names kept in Highscores
float_t _calculateDeltaTime();
void _saveHighScore(unsigned int test_score);
void _initHighScore();
void _newGame();
void _pause();
void _showTitleScreen();
void _initTitleScreen();
void _checkLives();
void _checkBrickCollision();
void _showControls();
void _showOptions();
void _showCredits();
void _showHiScores();
boolean _drawNewHighscore(unsigned int newscore);
bool _checkCollision(int8_t obj1_x, int8_t obj1_y,uint8_t obj1_sizeX,uint8_t obj1_sizeY,int8_t obj2_x, int8_t obj2_y,uint8_t obj2_sizeX,uint8_t obj2_sizeY );
// Represents the current state of the game
enum class GameState : uint8_t {
TITLESCREEN,
RUNNING,
SHOW_CONTROLS,
SHOW_MORE_OPTIONS,
SHOW_SCORES,
SHOW_CREDITS,
SHOW_OPTIONS,
PAUSE,
GAMEOVER,
RESTART
};
// game state
GameState _state;
float _deltaTime;
float _oldTime;
int _highscore[_NUM_HIGHSCORE];
char _name[_NUM_HIGHSCORE][_NAME_LENGTH+1];
uint8_t _animStartMenu;
uint8_t _dirAnimMenu;
bool _initOptions;
uint8_t _currentSelectedOption;
float _frameCount;
float _frameStart;
public:
boolean sound, lightSides;
uint16_t score;
uint8_t currentLevelNb, bonusNb, lives;
void init();
void showInfos();
void loop();
};