-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.h
104 lines (74 loc) · 2.25 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#pragma once
#include <SDL.h>
#include "Math.h"
#include <vector>
#include <unordered_map>
#include <string>
class Game
{
public:
// constructor
Game();
// initialize
bool Initialize();
// Run Loop
void RunLoop();
// add/remove actor functions
void AddActor(class Actor* actor);
void RemoveActor(class Actor* actor);
void AddSprite(class SpriteComponent* sprite);
void RemoveSprite(class SpriteComponent* sprite);
// Function for retrieving textures
SDL_Texture* GetTexture(const std::string& fileName);
// Function for retrieving fonts
class Font* GetFont(const std::string& fileName);
// Function for returning the renderer
SDL_Renderer* GetRenderer() const { return mRenderer; }
class AudioSystem* GetAudioSystem() { return mAudioSystem; }
void ResizeWindow(Vector2 size);
// Return entire UI stack by reference
const std::vector<class UIScreen*>& GetUIStack() { return mUIStack; };
// Push specified UIScreen onto stack
void PushUI(class UIScreen* screen);
void SetGameBoard(class GameBoard* board) { mGameBoard = board; }
GameBoard* GetGameBoard() const { return mGameBoard; }
int GetScreenHeight() const { return mScreenHeight; }
int GetScreenWidth() const { return mScreenWidth; }
void SetScreenHeight(int height) { mScreenHeight = height; }
void SetScreenWidth(int width) { mScreenWidth = width; }
//shutdown game loop
void ShutDown();
class GameUI* gui;
private:
// helper functions for the game loop
void ProcessInput();
void UpdateGame();
void GenerateOutput();
void LoadData();
void UnloadData();
// Window created by SDL
SDL_Window* mWindow;
// game running bool
bool mIsRunning;
int mScreenWidth;
int mScreenHeight;
// SDL renderer
SDL_Renderer* mRenderer;
// FMOD audio system
class AudioSystem* mAudioSystem;
// vectors containing active actors and pending actors
std::vector<class Actor*> mActors;
std::vector<class Actor*> mPendingActors;
std::vector<class SpriteComponent*> mSprites;
int mTicksCount;
// Map of textures
std::unordered_map<std::string, SDL_Texture*> mTextures;
// Map of fonts
std::unordered_map<std::string, Font*> mFonts;
// UI screen stack for the game
std::vector<class UIScreen*> mUIStack;
class GameBoard* mGameBoard;
bool mUpdatingActors;
bool DrawCalled;
};
void foo();