aboutsummaryrefslogtreecommitdiff
path: root/backends/modular-backend.cpp
blob: fe3991af655fb89364af97f51c3b7202e8aeebbe (plain)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program 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 2
 * of the License, or (at your option) any later version.

 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#include "backends/modular-backend.h"

#include "backends/fs/fs-factory.h"
#include "backends/audiocd/audiocd.h"
#include "backends/graphics/graphics.h"
#include "backends/mutex/mutex.h"

#include "audio/mixer.h"
#include "common/events.h"
#include "gui/message.h"
#include "graphics/pixelformat.h"

ModularBackend::ModularBackend()
	:
	_fsFactory(0),
	_eventManager(0),
	_savefileManager(0),
	_timerManager(0),
	_mutexManager(0),
	_graphicsManager(0),
	_mixer(0),
	_audiocdManager(0) {

}

ModularBackend::~ModularBackend() {
	delete _fsFactory;
	_fsFactory = 0;
	delete _graphicsManager;
	_graphicsManager = 0;
	delete _eventManager;
	_eventManager = 0;
	delete _mixer;
	_mixer = 0;
	delete _audiocdManager;
	_audiocdManager = 0;
	delete _savefileManager;
	_savefileManager = 0;
	delete _timerManager;
	_timerManager = 0;
	delete _mutexManager;
	_mutexManager = 0;
}

bool ModularBackend::hasFeature(Feature f) {
	return _graphicsManager->hasFeature(f);
}

void ModularBackend::setFeatureState(Feature f, bool enable) {
	return _graphicsManager->setFeatureState(f, enable);
}

bool ModularBackend::getFeatureState(Feature f) {
	return _graphicsManager->getFeatureState(f);
}

GraphicsManager *ModularBackend::getGraphicsManager() {
	assert(_graphicsManager);
	return (GraphicsManager *)_graphicsManager;
}

const OSystem::GraphicsMode *ModularBackend::getSupportedGraphicsModes() const {
	return _graphicsManager->getSupportedGraphicsModes();
}

int ModularBackend::getDefaultGraphicsMode() const {
	return _graphicsManager->getDefaultGraphicsMode();
}

bool ModularBackend::setGraphicsMode(int mode) {
	return _graphicsManager->setGraphicsMode(mode);
}

int ModularBackend::getGraphicsMode() const {
	return _graphicsManager->getGraphicsMode();
}

void ModularBackend::resetGraphicsScale() {
	_graphicsManager->resetGraphicsScale();
}

#ifdef USE_RGB_COLOR

Graphics::PixelFormat ModularBackend::getScreenFormat() const {
	return _graphicsManager->getScreenFormat();
}

Common::List<Graphics::PixelFormat> ModularBackend::getSupportedFormats() const {
	return _graphicsManager->getSupportedFormats();
}

#endif

void ModularBackend::initSize(uint w, uint h, const Graphics::PixelFormat *format ) {
	_graphicsManager->initSize(w, h, format);
}

int ModularBackend::getScreenChangeID() const {
	return _graphicsManager->getScreenChangeID();
}

void ModularBackend::beginGFXTransaction() {
	_graphicsManager->beginGFXTransaction();
}

OSystem::TransactionError ModularBackend::endGFXTransaction() {
	return _graphicsManager->endGFXTransaction();
}

int16 ModularBackend::getHeight() {
	return _graphicsManager->getHeight();
}

int16 ModularBackend::getWidth() {
	return _graphicsManager->getWidth();
}

PaletteManager *ModularBackend::getPaletteManager() {
	return _graphicsManager;
}

void ModularBackend::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
	_graphicsManager->copyRectToScreen(buf, pitch, x, y, w, h);
}

Graphics::Surface *ModularBackend::lockScreen() {
	return _graphicsManager->lockScreen();
}

void ModularBackend::unlockScreen() {
	_graphicsManager->unlockScreen();
}

void ModularBackend::fillScreen(uint32 col) {
	_graphicsManager->fillScreen(col);
}

void ModularBackend::updateScreen() {
	_graphicsManager->updateScreen();
}

void ModularBackend::setShakePos(int shakeOffset) {
	_graphicsManager->setShakePos(shakeOffset);
}
void ModularBackend::setFocusRectangle(const Common::Rect& rect) {
	_graphicsManager->setFocusRectangle(rect);
}

void ModularBackend::clearFocusRectangle() {
	_graphicsManager->clearFocusRectangle();
}

void ModularBackend::showOverlay() {
	_graphicsManager->showOverlay();
}

void ModularBackend::hideOverlay() {
	_graphicsManager->hideOverlay();
}

Graphics::PixelFormat ModularBackend::getOverlayFormat() const {
	return _graphicsManager->getOverlayFormat();
}

void ModularBackend::clearOverlay() {
	_graphicsManager->clearOverlay();
}

void ModularBackend::grabOverlay(OverlayColor *buf, int pitch) {
	_graphicsManager->grabOverlay(buf, pitch);
}

void ModularBackend::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
	_graphicsManager->copyRectToOverlay(buf, pitch, x, y, w, h);
}

int16 ModularBackend::getOverlayHeight() {
	return _graphicsManager->getOverlayHeight();
}

int16 ModularBackend::getOverlayWidth() {
	return _graphicsManager->getOverlayWidth();
}

bool ModularBackend::showMouse(bool visible) {
	return _graphicsManager->showMouse(visible);
}

void ModularBackend::warpMouse(int x, int y) {
	_graphicsManager->warpMouse(x, y);
}

void ModularBackend::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
	_graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format);
}

void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num) {
	_graphicsManager->setCursorPalette(colors, start, num);
}

void ModularBackend::disableCursorPalette(bool disable) {
	_graphicsManager->disableCursorPalette(disable);
}

Common::TimerManager *ModularBackend::getTimerManager() {
	assert(_timerManager);
	return _timerManager;
}

Common::EventManager *ModularBackend::getEventManager() {
	assert(_eventManager);
	return _eventManager;
}

OSystem::MutexRef ModularBackend::createMutex() {
	assert(_mutexManager);
	return _mutexManager->createMutex();
}

void ModularBackend::lockMutex(MutexRef mutex) {
	assert(_mutexManager);
	_mutexManager->lockMutex(mutex);
}

void ModularBackend::unlockMutex(MutexRef mutex) {
	assert(_mutexManager);
	_mutexManager->unlockMutex(mutex);
}

void ModularBackend::deleteMutex(MutexRef mutex) {
	assert(_mutexManager);
	_mutexManager->deleteMutex(mutex);
}

Audio::Mixer *ModularBackend::getMixer() {
	assert(_mixer);
	return (Audio::Mixer *)_mixer;
}

AudioCDManager *ModularBackend::getAudioCDManager() {
	assert(_audiocdManager);
	return _audiocdManager;
}

void ModularBackend::displayMessageOnOSD(const char *msg) {
	_graphicsManager->displayMessageOnOSD(msg);
}

Common::SaveFileManager *ModularBackend::getSavefileManager() {
	assert(_savefileManager);
	return _savefileManager;
}

FilesystemFactory *ModularBackend::getFilesystemFactory() {
	assert(_fsFactory);
	return _fsFactory;
}