2010-06-10 20:31:08 +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 17:47:58 +00: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.
|
2014-02-18 01:34:18 +00:00
|
|
|
*
|
2010-06-10 20:31:08 +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.
|
2014-02-18 01:34:18 +00:00
|
|
|
*
|
2010-06-10 20:31:08 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 17:47:58 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-06-10 20:31:08 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BACKENDS_MODULAR_BACKEND_H
|
|
|
|
#define BACKENDS_MODULAR_BACKEND_H
|
|
|
|
|
2011-06-08 12:29:22 +00:00
|
|
|
#include "backends/base-backend.h"
|
2011-02-07 17:53:15 +00:00
|
|
|
|
|
|
|
class GraphicsManager;
|
2019-11-30 20:22:19 +00:00
|
|
|
class MixerManager;
|
2010-06-10 20:31:08 +00:00
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
/**
|
2020-08-01 23:05:25 +00:00
|
|
|
* Base classes for modular backends.
|
2011-06-19 22:59:48 +00:00
|
|
|
*
|
2020-08-01 23:05:25 +00:00
|
|
|
* They wrap most functions to their manager equivalent, but not
|
2010-07-02 06:44:42 +00:00
|
|
|
* all OSystem functions are implemented here.
|
2011-06-19 22:59:48 +00:00
|
|
|
*
|
2020-08-01 23:05:25 +00:00
|
|
|
* A backend derivated from these classes, will need to implement
|
2010-07-02 06:44:42 +00:00
|
|
|
* these functions on its own:
|
|
|
|
* OSystem::pollEvent()
|
2021-08-24 22:53:21 +00:00
|
|
|
* OSystem::createMutex()
|
2010-07-02 06:44:42 +00:00
|
|
|
* OSystem::getMillis()
|
|
|
|
* OSystem::delayMillis()
|
|
|
|
* OSystem::getTimeAndDate()
|
2019-11-05 22:19:47 +00:00
|
|
|
* OSystem::quit()
|
2011-06-19 22:59:48 +00:00
|
|
|
*
|
2010-07-02 06:44:42 +00:00
|
|
|
* And, it should also initialize all the managers variables
|
|
|
|
* declared in this class, or override their related functions.
|
|
|
|
*/
|
2020-08-01 23:05:25 +00:00
|
|
|
class ModularGraphicsBackend : virtual public BaseBackend {
|
2010-06-10 20:31:08 +00:00
|
|
|
public:
|
2020-08-01 23:05:25 +00:00
|
|
|
ModularGraphicsBackend();
|
|
|
|
virtual ~ModularGraphicsBackend();
|
2010-06-10 20:31:08 +00:00
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
/** @name Features */
|
|
|
|
//@{
|
|
|
|
|
2021-11-13 21:18:12 +00:00
|
|
|
bool hasFeature(Feature f) override;
|
|
|
|
void setFeatureState(Feature f, bool enable) override;
|
|
|
|
bool getFeatureState(Feature f) override;
|
2010-06-10 20:31:08 +00:00
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @name Graphics */
|
|
|
|
//@{
|
|
|
|
|
2020-08-01 21:58:43 +00:00
|
|
|
GraphicsManager *getGraphicsManager();
|
2021-11-13 21:18:12 +00:00
|
|
|
const GraphicsMode *getSupportedGraphicsModes() const override;
|
|
|
|
int getDefaultGraphicsMode() const override;
|
|
|
|
bool setGraphicsMode(int mode, uint flags = kGfxModeNoFlags) override;
|
|
|
|
int getGraphicsMode() const override;
|
2022-08-07 20:50:52 +00:00
|
|
|
bool setShader(const Common::String &name) override final;
|
2021-11-13 21:18:12 +00:00
|
|
|
const GraphicsMode *getSupportedStretchModes() const override final;
|
|
|
|
int getDefaultStretchMode() const override final;
|
|
|
|
bool setStretchMode(int mode) override final;
|
|
|
|
int getStretchMode() const override final;
|
|
|
|
uint getDefaultScaler() const override final;
|
|
|
|
uint getDefaultScaleFactor() const override final;
|
2021-06-24 12:17:58 +00:00
|
|
|
using BaseBackend::setScaler;
|
2021-11-13 21:18:12 +00:00
|
|
|
bool setScaler(uint mode, int factor) override final;
|
|
|
|
uint getScaler() const override final;
|
2021-11-22 00:01:20 +00:00
|
|
|
uint getScaleFactor() const override final;
|
2010-06-10 20:31:08 +00:00
|
|
|
#ifdef USE_RGB_COLOR
|
2021-11-13 21:18:12 +00:00
|
|
|
Graphics::PixelFormat getScreenFormat() const override final;
|
|
|
|
Common::List<Graphics::PixelFormat> getSupportedFormats() const override final;
|
2010-06-10 20:31:08 +00:00
|
|
|
#endif
|
2021-11-13 21:18:12 +00:00
|
|
|
void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) override final;
|
|
|
|
void initSizeHint(const Graphics::ModeList &modes) override final;
|
|
|
|
int getScreenChangeID() const override final;
|
|
|
|
|
|
|
|
void beginGFXTransaction() override final;
|
|
|
|
OSystem::TransactionError endGFXTransaction() override final;
|
|
|
|
|
|
|
|
int16 getHeight() override final;
|
|
|
|
int16 getWidth() override final;
|
|
|
|
PaletteManager *getPaletteManager() override final;
|
|
|
|
void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override final;
|
|
|
|
Graphics::Surface *lockScreen() override final;
|
|
|
|
void unlockScreen() override final;
|
|
|
|
void fillScreen(uint32 col) override final;
|
|
|
|
void updateScreen() override final;
|
|
|
|
void setShakePos(int shakeXOffset, int shakeYOffset) override final;
|
|
|
|
void setFocusRectangle(const Common::Rect& rect) override final;
|
|
|
|
void clearFocusRectangle() override final;
|
|
|
|
|
2022-11-05 13:11:20 +00:00
|
|
|
void showOverlay(bool inGUI) override final;
|
2021-11-13 21:18:12 +00:00
|
|
|
void hideOverlay() override final;
|
|
|
|
bool isOverlayVisible() const override final;
|
|
|
|
Graphics::PixelFormat getOverlayFormat() const override final;
|
|
|
|
void clearOverlay() override final;
|
|
|
|
void grabOverlay(Graphics::Surface &surface) override final;
|
|
|
|
void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override final;
|
|
|
|
int16 getOverlayHeight() override final;
|
|
|
|
int16 getOverlayWidth() override final;
|
|
|
|
|
|
|
|
float getHiDPIScreenFactor() const override final;
|
|
|
|
|
|
|
|
bool showMouse(bool visible) override final;
|
|
|
|
void warpMouse(int x, int y) override final;
|
2023-02-05 22:42:03 +00:00
|
|
|
void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL, const byte *mask = NULL) override final;
|
2021-11-13 21:18:12 +00:00
|
|
|
void setCursorPalette(const byte *colors, uint start, uint num) override final;
|
|
|
|
bool lockMouse(bool lock) override final;
|
2010-06-10 20:31:08 +00:00
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
//@}
|
|
|
|
|
2020-08-01 23:05:25 +00:00
|
|
|
/** @name Miscellaneous */
|
2010-07-02 06:44:42 +00:00
|
|
|
//@{
|
|
|
|
|
2021-11-13 21:18:12 +00:00
|
|
|
void displayMessageOnOSD(const Common::U32String &msg) override final;
|
|
|
|
void displayActivityIconOnOSD(const Graphics::Surface *icon) override final;
|
2010-06-10 20:31:08 +00:00
|
|
|
|
2021-11-13 21:18:12 +00:00
|
|
|
void saveScreenshot() override final;
|
2020-10-15 11:56:45 +00:00
|
|
|
|
2010-07-02 06:44:42 +00:00
|
|
|
//@}
|
|
|
|
|
2020-08-01 23:05:25 +00:00
|
|
|
protected:
|
|
|
|
/** @name Managers variables */
|
2010-07-02 06:44:42 +00:00
|
|
|
//@{
|
|
|
|
|
2020-08-01 23:05:25 +00:00
|
|
|
GraphicsManager *_graphicsManager;
|
|
|
|
|
|
|
|
//@}
|
|
|
|
};
|
|
|
|
|
2019-11-30 20:22:19 +00:00
|
|
|
class ModularMixerBackend : virtual public BaseBackend {
|
|
|
|
public:
|
|
|
|
ModularMixerBackend();
|
|
|
|
virtual ~ModularMixerBackend();
|
|
|
|
|
|
|
|
/** @name Sound */
|
|
|
|
//@{
|
|
|
|
|
|
|
|
virtual MixerManager *getMixerManager();
|
2021-11-13 21:18:12 +00:00
|
|
|
Audio::Mixer *getMixer() override final;
|
2019-11-30 20:22:19 +00:00
|
|
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/** @name Managers variables */
|
|
|
|
//@{
|
|
|
|
|
|
|
|
MixerManager *_mixerManager;
|
|
|
|
|
|
|
|
//@}
|
|
|
|
};
|
|
|
|
|
2010-06-10 20:31:08 +00:00
|
|
|
#endif
|