ScummVM API documentation
lastexpress.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 #ifndef LASTEXPRESS_LASTEXPRESS_H
23 #define LASTEXPRESS_LASTEXPRESS_H
24 
25 #include "lastexpress/debug.h"
26 #include "lastexpress/eventhandler.h"
27 
28 #include "common/random.h"
29 
30 #include "engines/engine.h"
31 
32 #include "graphics/pixelformat.h"
33 
34 struct ADGameDescription;
35 
58 namespace LastExpress {
59 
60 class Cursor;
61 class Font;
62 class GraphicsManager;
63 class Logic;
64 class Menu;
65 class ResourceManager;
66 class SceneManager;
67 class SoundManager;
68 
69 class LastExpressEngine : public Engine {
70 protected:
71  // Engine APIs
72  Common::Error run() override;
73  bool hasFeature(EngineFeature f) const override;
74 
75 public:
77  ~LastExpressEngine() override;
78 
79  // Misc
80  Common::RandomSource& getRandom() {return _random; }
81 
82  // Game
83  Cursor *getCursor() const { return _cursor; }
84  Font *getFont() const { return _font; }
85  Logic *getGameLogic() const { return _logic; }
86  Menu *getGameMenu() const { return _menu; }
87 
88  // Managers
89  GraphicsManager *getGraphicsManager() const { return _graphicsMan; }
90  ResourceManager *getResourceManager() const { return _resMan; }
91  SceneManager *getSceneManager() const { return _sceneMan; }
92  SoundManager *getSoundManager() const { return _soundMan; }
93 
94  // Event handling
95  bool handleEvents();
96  void pollEvents();
97 
98  void backupEventHandlers();
99  void restoreEventHandlers();
100  void setEventHandlers(EventHandler::EventFunction *eventMouse, EventHandler::EventFunction *eventTick);
101 
102  bool isDemo() const;
103 
104  Common::String getTargetName() const;
105 
106  // Frame Counter
107  // TODO: all callers could use _system->getMillis() directly without extra conversions
108  uint32 getFrameCounter() const;
109 
110 private:
111  const ADGameDescription *_gameDescription;
112  Graphics::PixelFormat _pixelFormat;
113 
114  // Misc
115  Debugger *_debugger;
116  Common::RandomSource _random;
117 
118  // Game
119  Cursor *_cursor;
120  Font *_font;
121  Logic *_logic;
122  Menu *_menu;
123 
124  // Frame counter
125  uint32 _lastFrameCount;
126 
127  // Managers
128  GraphicsManager *_graphicsMan;
129  ResourceManager *_resMan;
130  SceneManager *_sceneMan;
131  SoundManager *_soundMan;
132 
133  // Event handlers
134  EventHandler::EventFunction *_eventMouse;
135  EventHandler::EventFunction *_eventTick;
136 
137  EventHandler::EventFunction *_eventMouseBackup;
138  EventHandler::EventFunction *_eventTickBackup;
139 };
140 
141 } // End of namespace LastExpress
142 
143 #endif // LASTEXPRESS_LASTEXPRESS_H
Definition: font.h:48
Definition: str.h:59
EngineFeature
Definition: engine.h:253
Definition: error.h:84
Definition: lastexpress.h:69
Definition: pixelformat.h:138
Definition: advancedDetector.h:163
Definition: random.h:44
Common::Error run() override
Definition: animation.h:45
Definition: cursor.h:62
Definition: logic.h:43
Definition: graphics.h:29
Definition: atari-cursor.h:38
Definition: menu.h:42
Definition: resource.h:36
Definition: func.h:437
Definition: graphics.h:37
Definition: sound.h:34
Definition: debug.h:47
Definition: system.h:161
Definition: scenes.h:37
Definition: engine.h:144
bool hasFeature(EngineFeature f) const override