2009-01-30 03:35:47 +00:00
|
|
|
/* 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.
|
|
|
|
*
|
2021-12-26 18:47:58 +01:00
|
|
|
* 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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2011-08-05 21:09:07 +01:00
|
|
|
*
|
2009-01-30 03:35:47 +00:00
|
|
|
* 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.
|
2011-08-05 21:09:07 +01:00
|
|
|
*
|
2009-01-30 03:35:47 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-01-30 03:35:47 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "backends/base-backend.h"
|
2011-06-06 15:51:46 +02:00
|
|
|
|
2021-01-05 22:54:53 +00:00
|
|
|
#include "graphics/scalerplugin.h"
|
2020-10-10 15:16:23 +01:00
|
|
|
|
2011-06-06 15:51:46 +02:00
|
|
|
#ifndef DISABLE_DEFAULT_EVENT_MANAGER
|
2009-01-30 03:35:47 +00:00
|
|
|
#include "backends/events/default/default-events.h"
|
2011-06-06 15:51:46 +02:00
|
|
|
#endif
|
|
|
|
|
2011-06-08 14:29:22 +02:00
|
|
|
#ifndef DISABLE_DEFAULT_AUDIOCD_MANAGER
|
|
|
|
#include "backends/audiocd/default/default-audiocd.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-01-30 03:35:47 +00:00
|
|
|
#include "gui/message.h"
|
|
|
|
|
2021-01-05 22:54:53 +00:00
|
|
|
bool BaseBackend::setScaler(const char *name, int factor) {
|
|
|
|
if (!name)
|
|
|
|
return false;
|
|
|
|
|
2021-01-06 23:02:19 +00:00
|
|
|
if (!scumm_stricmp(name, "default"))
|
|
|
|
return setScaler(getDefaultScaler(), factor);
|
|
|
|
|
2021-01-05 22:54:53 +00:00
|
|
|
const PluginList &scalerPlugins = ScalerMan.getPlugins();
|
|
|
|
|
|
|
|
for (uint scalerIndex = 0; scalerIndex < scalerPlugins.size(); scalerIndex++) {
|
|
|
|
if (!scumm_stricmp(scalerPlugins[scalerIndex]->get<ScalerPluginObject>().getName(), name)) {
|
|
|
|
return setScaler(scalerIndex, factor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-13 22:12:25 +05:30
|
|
|
void BaseBackend::displayMessageOnOSD(const Common::U32String &msg) {
|
2009-01-30 03:35:47 +00:00
|
|
|
// Display the message for 1.5 seconds
|
|
|
|
GUI::TimedMessageDialog dialog(msg, 1500);
|
|
|
|
dialog.runModal();
|
|
|
|
}
|
|
|
|
|
2011-06-06 15:51:46 +02:00
|
|
|
void BaseBackend::initBackend() {
|
2011-06-08 14:29:22 +02:00
|
|
|
// Init audio CD manager
|
|
|
|
#ifndef DISABLE_DEFAULT_AUDIOCD_MANAGER
|
|
|
|
if (!_audiocdManager)
|
|
|
|
_audiocdManager = new DefaultAudioCDManager();
|
2011-06-06 15:51:46 +02:00
|
|
|
#endif
|
2011-06-08 14:22:00 +02:00
|
|
|
|
|
|
|
OSystem::initBackend();
|
2009-01-30 03:35:47 +00:00
|
|
|
}
|
|
|
|
|
2009-02-15 21:20:21 +00:00
|
|
|
void BaseBackend::fillScreen(uint32 col) {
|
2009-01-30 03:35:47 +00:00
|
|
|
Graphics::Surface *screen = lockScreen();
|
2019-11-09 14:52:05 +00:00
|
|
|
if (screen)
|
|
|
|
screen->fillRect(Common::Rect(screen->w, screen->h), col);
|
2009-01-30 03:35:47 +00:00
|
|
|
unlockScreen();
|
|
|
|
}
|
2020-08-02 21:07:58 +01:00
|
|
|
|
|
|
|
void EventsBaseBackend::initBackend() {
|
|
|
|
// Init Event manager
|
|
|
|
#ifndef DISABLE_DEFAULT_EVENT_MANAGER
|
|
|
|
if (!_eventManager)
|
|
|
|
_eventManager = new DefaultEventManager(this);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BaseBackend::initBackend();
|
|
|
|
}
|