ScummVM API documentation
crab.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 CRAB_H
23#define CRAB_H
24
25#include "common/random.h"
26#include "common/serializer.h"
27#include "graphics/pixelformat.h"
28
29#include "crab/detection.h"
30
31namespace Graphics {
32class ManagedSurface;
33class Screen;
34} // End of namespace Graphics
35
36namespace Crab {
37
38class App;
39struct CrabGameDescription;
40
41class LoadingScreen;
42
43struct FilePaths;
44struct TempValue;
45class StringPool;
46class ScreenSettings;
47
48namespace pyrodactyl {
49namespace event {
50struct GameEventStore;
51} // End of namespace event
52
53namespace ui {
54class SlideShow;
55class OptionMenu;
56
57template<typename FileType>
58class FileMenu;
59
60class SaveFileData;
61} // End of namespace ui
62
63namespace image {
64class ImageManager;
65} // End of namespace image
66
67namespace input {
68class Cursor;
69class InputManager;
70} // End of namespace input
71
72namespace music {
73class MusicManager;
74} // End of namespace music
75
76namespace text {
77class TextManager;
78} // End of namespace text
79
80} // End of namespace pyrodactyl
81
82enum DebugDraw {
83 DRAW_TMX = 1 << 0,
84 DRAW_PROP_BOUNDS = 1 << 1,
85 DRAW_SPRITE_BOUNDS = 1 << 2,
86 DRAW_PATHING = 1 << 3,
87 DRAW_FPS = 1 << 4
88};
89
90class CrabEngine : public Engine {
91private:
92 const ADGameDescription *_gameDescription;
93 Common::RandomSource _randomSource;
94 App *_app;
95
96protected:
97 // Engine APIs
98 Common::Error run() override;
99
100public:
101 Graphics::Screen *_screen = nullptr;
102 Graphics::PixelFormat _format;
103
104 pyrodactyl::image::ImageManager *_imageManager = nullptr;
105 pyrodactyl::text::TextManager *_textManager = nullptr;
106 pyrodactyl::input::InputManager *_inputManager = nullptr;
107 pyrodactyl::music::MusicManager *_musicManager = nullptr;
108
109 pyrodactyl::input::Cursor *_mouse = nullptr;
110 pyrodactyl::event::GameEventStore *_eventStore = nullptr;
111
112 // Should these really be inside the Engine class?
113 LoadingScreen *_loadingScreen = nullptr;
114 pyrodactyl::ui::SlideShow *_helpScreen = nullptr;
115 pyrodactyl::ui::OptionMenu *_optionMenu = nullptr;
117
118 FilePaths *_filePath = nullptr;
119 TempValue *_tempData = nullptr;
120 StringPool *_stringPool = nullptr;
121 ScreenSettings *_screenSettings = nullptr;
122
123 // Keeps a copy of latest screen for thumbnail
124 Graphics::ManagedSurface *_thumbnail;
125
126 // What components to draw lines for (if any)
127 uint32 _debugDraw;
128
129 Common::FSNode _gameDataDir;
130
131 CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
132 ~CrabEngine() override;
133 void initializePath(const Common::FSNode &gamePath) override;
134
135 uint32 getFeatures() const;
136
141
145 uint32 getRandomNumber(uint maxNum) {
146 return _randomSource.getRandomNumber(maxNum);
147 }
148
149 bool hasFeature(EngineFeature f) const override {
150 return (f == kSupportsLoadingDuringRuntime) ||
153 };
154
155 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
156 return true;
157 }
158
159 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
160
166
167 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
168 Common::Error loadGameState(int slot) override;
169
170 void syncSoundSettings() override;
171
172
173};
174
175extern CrabEngine *g_engine;
176
177} // End of namespace Crab
178
179#endif // CRAB_H
Definition: error.h:81
Definition: fs.h:69
Definition: random.h:44
uint getRandomNumber(uint max)
Definition: serializer.h:80
Definition: str.h:59
Definition: ustr.h:57
Definition: app.h:39
Definition: crab.h:90
void initializePath(const Common::FSNode &gamePath) override
Common::Error loadGameState(int slot) override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: crab.h:155
uint32 getRandomNumber(uint maxNum)
Definition: crab.h:145
Common::Error run() override
Common::String getGameId() const
void syncSoundSettings() override
bool hasFeature(EngineFeature f) const override
Definition: crab.h:149
Common::Error syncGame(Common::Serializer &s)
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: LoadingScreen.h:41
Definition: ScreenSettings.h:102
Definition: GameParam.h:107
Definition: ImageManager.h:63
Definition: cursor.h:46
Definition: MusicManager.h:42
Definition: TextManager.h:52
Definition: FileMenu.h:47
Definition: OptionMenu.h:47
Definition: SlideShow.h:42
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
@ kSupportsReturnToLauncher
Definition: engine.h:296
@ kSupportsSavingDuringRuntime
Definition: engine.h:314
@ kSupportsLoadingDuringRuntime
Definition: engine.h:305
Definition: managed_surface.h:51
Definition: screen.h:47
Definition: musicplugin.h:131
Definition: system.h:166
Engine * g_engine
Definition: formatinfo.h:28
Definition: advancedDetector.h:164
Definition: GameParam.h:62
Definition: GameParam.h:153
Definition: eventstore.h:43
Definition: atari-cursor.h:35
Definition: pixelformat.h:138
Definition: atari-screen.h:58