-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.hpp
78 lines (56 loc) · 1.56 KB
/
game.hpp
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
// code from homework 4
#include <SDL_image.h>
#include <stdio.h>
#include <SDL_mixer.h>
#include <stdlib.h>
#include <time.h>
#include "spaceship.hpp"
#include "cloudmanager.hpp"
#include "diamond_manager.hpp"
#include "attackManager.hpp"
#include "score.hpp"
#pragma once
// SINGLETON CLASS
class Game{
//Screen dimension constants
const int SCREEN_WIDTH = 1200;
const int SCREEN_HEIGHT = 700;
//The window we'll be rendering to
SDL_Window* gWindow = NULL;
//Current displayed texture
SDL_Texture* gTexture = NULL;
// to keep track of the score on the screen
Score score;
// ctor
Game();
// dtor to destroy all dynamically allocated memory
~Game();
// singleton implementation
static Game* Instance;
// to maintain the health and lives
int x=0;
Performance Health;
public:
// for selecting the page that needs to be diplayed
int state = 0;
// initializes the renderer
bool init();
// loads the start page
bool loadMenu();
// loads the level one of the game
bool loadMedia();
// loads the rules page of the game
bool loadRules();
// loads the level two of the game
bool loadLevelTwo();
// closes everything; sets the pointers to nullptr
void close();
// loads all the textures; sets the path
SDL_Texture* loadTexture( std::string path );
// returns the dynamically created pointer of this class
static Game* getPointer();
// main work happens here
void run();
// displays the score
void showScore();
};