Repository navigation
Expand file tree
/
Copy pathGame.h
More file actions
102 lines (96 loc) · 3 KB
/
Copy pathGame.h
File metadata and controls
102 lines (96 loc) · 3 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
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
/*
* Copyright 2010 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenXcom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENXCOM_GAME_H
#define OPENXCOM_GAME_H
#include <list>
#include <string>
#include "SDL.h"
namespace OpenXcom
{
class State;
class Screen;
class Cursor;
class Language;
class ResourcePack;
class SavedGame;
class Ruleset;
class FpsCounter;
/**
* The core of the game engine, manages the game's entire contents and structure.
* Takes care of encapsulating all the core SDL commands, provides access to all
* the game's resources and contains a stack state machine to handle all the
* initializations, events and blits of each state, as well as transitions.
*/
class Game
{
private:
SDL_Event _event;
Screen *_screen;
Cursor *_cursor;
Language *_lang;
std::list<State*> _states, _deleted;
ResourcePack *_res;
SavedGame *_save;
Ruleset *_rules;
bool _quit, _init;
FpsCounter *_fpsCounter;
public:
/// Creates a new game and initializes SDL.
Game(const std::string &title, int width, int height, int bpp);
/// Cleans up all the game's resources and shuts down SDL.
~Game();
/// Starts the game's state machine.
void run();
/// Quits the game.
void quit();
/// Sets the game's audio volume.
void setVolume(int sound, int music);
/// Gets the game's display screen.
Screen *const getScreen() const;
/// Gets the game's cursor.
Cursor *const getCursor() const;
/// Gets the FpsCounter.
FpsCounter *const getFpsCounter() const;
/// Sets the game's 8bpp palette.
void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256);
/// Resets the state stack to a new state.
void setState(State *state);
/// Pushes a new state into the state stack.
void pushState(State *state);
/// Pops the last state from the state stack.
void popState();
/// Gets the currently loaded language.
Language *const getLanguage() const;
/// Loads a new language for the game.
void loadLanguage(const std::string &filename);
/// Gets the currently loaded resource pack.
ResourcePack *const getResourcePack() const;
/// Sets a new resource pack for the game.
void setResourcePack(ResourcePack *res);
/// Gets the currently loaded saved game.
SavedGame *const getSavedGame() const;
/// Sets a new saved game for the game
void setSavedGame(SavedGame *save);
/// Gets the currently loaded ruleset
Ruleset *const getRuleset() const;
/// Sets a new ruleset for the game
void setRuleset(Ruleset *rules);
};
}
#endif