forked from ManalHasan/OOP-Project-Manal-Moiz-Naaseh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameLoop.hpp
95 lines (86 loc) · 2.21 KB
/
GameLoop.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#pragma once
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include "TextureManager.hpp"
#include "Background.hpp"
#include "Object.hpp"
#include "Player.hpp"
#include "Mainmenu.hpp"
#include "SelectBird.hpp"
#include "Obstacles.hpp"
#include "CollisionManager.hpp"
#include "EndWindow.hpp"
#include "BirdB.hpp"
#include "BirdY.hpp"
#include "BirdO.hpp"
#include "Score.hpp"
#include "PauseScreen.hpp"
#include "Instruction.hpp"
#include "soundManager.hpp"
#include <iostream>
using namespace std;
//While the game is running this class will be implemented with the help of all the other classes
class GameLoop {
private:
Player *p;//blue bird
Player *y;// yellow bird
Player *o;//owl
Background b;//Static background
Background ground1, ground2;//base of the background
//Obstacles
Obstacles Pipe_Above1;
Obstacles Pipe_Below1;
Obstacles Pipe_Above2;
Obstacles Pipe_Below2;
Obstacles Pipe_Above3;
Obstacles Pipe_Below3;
SDLManager sound;
Score score;
MainMenu menu;
SelectBird sb;
EndWindow ew;
Instructions ins;
PauseScreen PScreen;
//Dimensions of the window
const int Height = 600;
const int Width = 800;
//Helpful for continuos generation of obstacles
int variance1 = rand() % 201 - 100;
int variance2 = rand() % 201 - 100;
int variance3 = rand() % 201 - 100;
//To check which states we are in
bool GameState;
bool startState;
bool PauseState;
SDL_Window* window;
SDL_Event event1;
SDL_Renderer* renderer;
int timer=0;
int t1=0;
int s=0;
int score1=0;
public:
GameLoop();
~GameLoop();
void SetHighscore();
void MainMenu();
void Instructions();
void SelectBird();
void Paused();
void Endgame();
bool getGameState() const;
bool getPauseState() const;
bool getStartState() const;
void Update();
void setStartState(const bool x);
void Reset();
void CollisionDetection();
void Initialize();
void Event();
void Render();
void Clear();
void bgMusic();
GameLoop(const GameLoop& other);
GameLoop &operator=(const GameLoop &other);
};