ScummVM API documentation
Game.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_GAME_H
29#define HPL_GAME_H
30
31#include "hpl1/engine/system/SystemTypes.h"
32
33namespace hpl {
34
35class cUpdater;
36class LowLevelGameSetup;
37class LowLevelSystem;
38class cLogicTimer;
39
40class cSystem;
41class cInput;
42class cResources;
43class cGraphics;
44class cScene;
45class cSound;
46class cPhysics;
47class cAI;
48class cGui;
49
51public:
52 cFPSCounter(LowLevelSystem *apLowLevelSystem);
53
54 void AddFrame();
55
56 float mfFPS;
57 float mfUpdateRate;
58
59private:
60 LowLevelSystem *mpLowLevelSystem;
61 int mlFramecounter;
62 float mfFrametimestart;
63 float mfFrametime;
64};
65
66//---------------------------------------------------
67
69public:
71
72 void AddString(const tString &asName, const tString &asValue);
73
74 void AddInt(const tString &asName, int alValue);
75 void AddFloat(const tString &asName, float afValue);
76 void AddBool(const tString &asName, bool abValue);
77
78 const tString &GetString(const tString &asName);
79
80 float GetFloat(const tString &asName, float afDefault);
81 int GetInt(const tString &asName, int alDefault);
82 bool GetBool(const tString &asName, bool abDefault);
83
84private:
86 tString msBlank;
87};
88
89//---------------------------------------------------
90
91class cGame {
92public:
93 cGame(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
94 cGame(LowLevelGameSetup *apGameSetup, int alWidth, int alHeight, int alBpp, bool abFullscreen,
95 unsigned int alUpdateRate = 60, int alMultisampling = 0);
96 ~cGame();
97
98private:
99 void GameInit(LowLevelGameSetup *apGameSetup, cSetupVarContainer &aVars);
100
101public:
105 void Run();
110 void Exit();
111
122
128
134
140
156
162
168
169 void ResetLogicTimer();
170 void SetUpdatesPerSec(int alUpdatesPerSec);
171 int GetUpdatesPerSec();
172 float GetStepSize();
173
174 cLogicTimer *GetLogicTimer() { return mpLogicTimer; }
175
176 float GetFPS();
177
178 void SetFPSUpdateRate(float afSec);
179 float GetFPSUpdateRate();
180
181 float GetFrameTime() { return mfFrameTime; }
182
183 float GetUpdateTime() { return mfUpdateTime; }
184
185 double GetGameTime() { return mfGameTime; }
186
187 void SetLimitFPS(bool abX) { mbLimitFPS = abX; }
188 bool GetLimitFPS() { return mbLimitFPS; }
189
190private:
191 bool mbGameIsDone;
192
193 float mfFrameTime;
194
195 float mfUpdateTime;
196
197 double mfGameTime;
198
199 LowLevelGameSetup *mpGameSetup;
200 cUpdater *mpUpdater;
201 cLogicTimer *mpLogicTimer;
202
203 cFPSCounter *mpFPSCounter;
204
205 bool mbLimitFPS;
206
207 // Modules that Game connnect to:
208 cResources *mpResources;
209 cSystem *mpSystem;
210 cInput *mpInput;
211 cGraphics *mpGraphics;
212 cScene *mpScene;
213 cSound *mpSound;
214 cPhysics *mpPhysics;
215 cAI *mpAI;
216 cGui *mpGui;
217};
218
219} // namespace hpl
220
221#endif // HPL_GAME_H
Definition: stablemap.h:43
Definition: str.h:59
Definition: low_level_game_setup.h:42
Definition: low_level_system.h:95
Definition: AI.h:40
Definition: Game.h:50
Definition: Game.h:91
cPhysics * GetPhysics()
cResources * GetResources()
void Exit()
cSystem * GetSystem()
cSound * GetSound()
cScene * GetScene()
cInput * GetInput()
void Run()
cGraphics * GetGraphics()
cGui * GetGui()
cUpdater * GetUpdater()
cAI * GetAI()
Definition: Graphics.h:46
Definition: Gui.h:73
Definition: Input.h:55
Definition: LogicTimer.h:35
Definition: Physics.h:67
Definition: Resources.h:160
Definition: Scene.h:61
Definition: Game.h:68
Definition: Sound.h:40
Definition: System.h:36
Definition: Updater.h:46