ScummVM API documentation
modular-backend.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 BACKENDS_MODULAR_BACKEND_H
23 #define BACKENDS_MODULAR_BACKEND_H
24 
25 #include "backends/base-backend.h"
26 
27 class GraphicsManager;
28 class MixerManager;
29 
48 class ModularGraphicsBackend : virtual public BaseBackend {
49 public:
51  virtual ~ModularGraphicsBackend();
52 
55 
56  bool hasFeature(Feature f) override;
57  void setFeatureState(Feature f, bool enable) override;
58  bool getFeatureState(Feature f) override;
59 
61 
64 
65  GraphicsManager *getGraphicsManager();
66  const GraphicsMode *getSupportedGraphicsModes() const override;
67  int getDefaultGraphicsMode() const override;
68  bool setGraphicsMode(int mode, uint flags = kGfxModeNoFlags) override;
69  int getGraphicsMode() const override;
70 #if defined(USE_IMGUI)
71  void setImGuiCallbacks(const ImGuiCallbacks &callbacks) override final;
72  void *getImGuiTexture(const Graphics::Surface &image, const byte *palette, int palCount) override final;
73  void freeImGuiTexture(void *texture) override final;
74 #endif
75  bool setShader(const Common::Path &name) override final;
76  const GraphicsMode *getSupportedStretchModes() const override final;
77  int getDefaultStretchMode() const override final;
78  bool setStretchMode(int mode) override final;
79  int getStretchMode() const override final;
80  uint getDefaultScaler() const override final;
81  uint getDefaultScaleFactor() const override final;
83  bool setScaler(uint mode, int factor) override final;
84  uint getScaler() const override final;
85  uint getScaleFactor() const override final;
86 #ifdef USE_RGB_COLOR
87  Graphics::PixelFormat getScreenFormat() const override final;
88  Common::List<Graphics::PixelFormat> getSupportedFormats() const override final;
89 #endif
90  void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL) override final;
91  void initSizeHint(const Graphics::ModeList &modes) override final;
92  int getScreenChangeID() const override final;
93 
94  void beginGFXTransaction() override final;
96 
97  int16 getHeight() override final;
98  int16 getWidth() override final;
99  PaletteManager *getPaletteManager() override final;
100  void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override final;
101  Graphics::Surface *lockScreen() override final;
102  void unlockScreen() override final;
103  void fillScreen(uint32 col) override final;
104  void fillScreen(const Common::Rect &r, uint32 col) override final;
105  void updateScreen() override final;
106  void setShakePos(int shakeXOffset, int shakeYOffset) override final;
107  void setFocusRectangle(const Common::Rect& rect) override final;
108  void clearFocusRectangle() override final;
109 
110  void showOverlay(bool inGUI) override final;
111  void hideOverlay() override final;
112  bool isOverlayVisible() const override final;
113  Graphics::PixelFormat getOverlayFormat() const override final;
114  void clearOverlay() override final;
115  void grabOverlay(Graphics::Surface &surface) override final;
116  void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override final;
117  int16 getOverlayHeight() override final;
118  int16 getOverlayWidth() override final;
119 
120  float getHiDPIScreenFactor() const override final;
121 
122  bool showMouse(bool visible) override final;
123  void warpMouse(int x, int y) override final;
124  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;
125  void setCursorPalette(const byte *colors, uint start, uint num) override final;
126  bool lockMouse(bool lock) override final;
127 
129 
132 
133  void displayMessageOnOSD(const Common::U32String &msg) override final;
134  void displayActivityIconOnOSD(const Graphics::Surface *icon) override final;
135 
136  void saveScreenshot() override final;
137 
139 
140 protected:
143 
144  GraphicsManager *_graphicsManager;
145 
147 };
148 
149 class ModularMixerBackend : virtual public BaseBackend {
150 public:
152  virtual ~ModularMixerBackend();
153 
156 
157  virtual MixerManager *getMixerManager();
158  Audio::Mixer *getMixer() override final;
159 
161 
162 protected:
165 
166  MixerManager *_mixerManager;
167 
169 };
170 
171 #endif
bool setGraphicsMode(int mode, uint flags=kGfxModeNoFlags) override
void initSizeHint(const Graphics::ModeList &modes) override final
void unlockScreen() override final
Definition: modular-backend.h:149
int getScreenChangeID() const override final
Definition: modular-backend.h:48
uint getDefaultScaleFactor() const override final
void clearOverlay() override final
Definition: surface.h:67
Definition: system.h:779
void hideOverlay() override final
void displayMessageOnOSD(const Common::U32String &msg) override final
void fillScreen(uint32 col) override final
virtual Audio::Mixer * getMixer()=0
PaletteManager * getPaletteManager() override final
void warpMouse(int x, int y) override final
Definition: array.h:52
void clearFocusRectangle() override final
Definition: pixelformat.h:138
Definition: system.h:730
bool isOverlayVisible() const override final
Feature
Definition: system.h:403
int getStretchMode() const override final
Definition: list.h:44
int16 getWidth() override final
Definition: rect.h:144
Definition: path.h:52
void setCursorPalette(const byte *colors, uint start, uint num) override final
uint getDefaultScaler() const override final
void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) override final
void updateScreen() override final
const GraphicsMode * getSupportedGraphicsModes() const override
void setFocusRectangle(const Common::Rect &rect) override final
int16 getOverlayHeight() override final
int getDefaultGraphicsMode() const override
bool setShader(const Common::Path &name) override final
uint getScaler() const override final
void setFeatureState(Feature f, bool enable) override
int16 getHeight() override final
void grabOverlay(Graphics::Surface &surface) override final
Definition: mixer.h:59
int getGraphicsMode() const override
Definition: ustr.h:57
bool setScaler(uint mode, int factor) override final
Definition: base-backend.h:32
TransactionError
Definition: system.h:1155
void displayActivityIconOnOSD(const Graphics::Surface *icon) override final
float getHiDPIScreenFactor() const override final
bool setStretchMode(int mode) override final
void saveScreenshot() override final
void initSize(uint width, uint height, const Graphics::PixelFormat *format=NULL) override final
bool setScaler(const char *name, int factor) override final
bool getFeatureState(Feature f) override
void setShakePos(int shakeXOffset, int shakeYOffset) override final
bool hasFeature(Feature f) override
int16 getOverlayWidth() override final
Definition: mixer.h:31
Definition: graphics.h:37
uint getScaleFactor() const override final
bool showMouse(bool visible) override final
bool lockMouse(bool lock) override final
Graphics::Surface * lockScreen() override final
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
const GraphicsMode * getSupportedStretchModes() const override final
void showOverlay(bool inGUI) override final
void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) override final
int getDefaultStretchMode() const override final
OSystem::TransactionError endGFXTransaction() override final
Definition: paletteman.h:47
void beginGFXTransaction() override final
Graphics::PixelFormat getOverlayFormat() const override final