-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game.h
76 lines (63 loc) · 1.55 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once
#include "Display.h"
#include "Sprite.h"
#include "Vehicle.h"
#include "Road.h"
extern "C" {
#include"./SDL2-2.0.10/include/SDL.h"
#include"./SDL2-2.0.10/include/SDL_main.h"
}
#define BACKGROUND_STRIPES_COUNT 15
#define BACKGROUND_STRIPES_HEIGHT 40
#define BACKGROUND_STRIPE_OFFSET 5
#define ROADS_COUNT 12
#define ROAD_OFFSET 10
#define ROADSIDE_WIDTH 80
#define SCOREBOARD_PADDING 4
#define SCOREBOARD_HEIGHT 4
#define LEGEND_WIDTH 20
#define LEGEND_HEIGHT 10
#define LEGEND_PADDING 4
#define REQUIREMENTS_WIDTH 20
#define REQUIREMENTS_HEIGHT 2
#define REQUIREMENTS_PADDING 4
#define PAUSE_BOX_HEIGHT 1
#define PAUSE_BOX_PADDING 4
#define DEFAULT_TREE_POSITION_X 75
#define TREES_COUNT 6
#define SAVES_LIST_PADDING 4
#define SAVES_DIRECTORY "saves"
#define ENTER_KEY 13
class Game
{
public:
Display display;
SDL_Event event;
Sprite* background_sprites[BACKGROUND_STRIPES_COUNT];
Sprite* roadsides[ROADS_COUNT * 2];
Sprite* trees[TREES_COUNT];
Road* roads[ROADS_COUNT];
Vehicle player;
const Uint8* keystates;
double duration, score;
bool quit, paused, load_menu_opened;
int save_choice, save_count;
Game();
virtual ~Game();
void DeleteSprites();
int Run();
void HandleInput(Vehicle*, SDL_Event*);
void DrawScoreboard();
void DrawLegend();
void DrawFullfilledRequirements();
void DrawSprites();
void MoveBackground(double);
void NewGame();
void Pause(double *);
void CountPoints(double);
bool CheckCollision(Sprite**, int);
void CheckCollisions();
void Save();
void Load();
void DrawSavesList();
};