ScummVM API documentation
gfxdriver.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
23#ifndef SCI_GRAPHICS_DRIVERS_GFXDRIVER_H
24#define SCI_GRAPHICS_DRIVERS_GFXDRIVER_H
25
26#include "common/rendermode.h"
27#include "common/rect.h"
28#include "graphics/pixelformat.h"
29#include "sci/detection.h"
30
31namespace Graphics {
32 class Cursor;
33}
34
35namespace Sci {
36
37struct PaletteMod;
38
39class GfxDriver {
40public:
41 enum DrawFlags : uint32 {
42 kHiResMode = 1 << 0,
43 kMovieMode = 1 << 1
44 };
45
46 GfxDriver(uint16 screenWidth, uint16 screenHeight, int numColors) : _screenW(screenWidth), _screenH(screenHeight), _numColors(numColors), _ready(false), _pixelSize(1) {}
47 virtual ~GfxDriver() {}
48 virtual bool initScreen(const Graphics::PixelFormat *srcRGBFormat = nullptr) = 0; // srcRGBFormat: expect incoming data to have the specified rgb pixel format (used for Mac hicolor videos)
49 virtual void setPalette(const byte *colors, uint start, uint num, bool update, const PaletteMod *palMods, const byte *palModMapping) = 0;
50 virtual void copyRectToScreen(const byte *src, int srcX, int srcY, int pitch, int destX, int destY, int w, int h, const PaletteMod *palMods, const byte *palModMapping) = 0;
51 virtual void replaceCursor(const void *cursor, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor) = 0;
52 virtual void replaceMacCursor(const Graphics::Cursor *cursor) = 0;
53 virtual Common::Point getMousePos() const;
54 virtual void setMousePos(const Common::Point &pos) const;
55 virtual void setShakePos(int shakeXOffset, int shakeYOffset) const;
56 virtual void clearRect(const Common::Rect &r) const;
57 virtual void copyCurrentBitmap(byte *dest, uint32 size) const = 0;
58 virtual void copyCurrentPalette(byte *dest, int start, int num) const;
59 virtual void drawTextFontGlyph(const byte *src, int pitch, int hiresDestX, int hiresDestY, int hiresW, int hiresH, int transpColor, const PaletteMod *palMods, const byte *palModMapping) = 0;
60 virtual byte remapTextColor(byte color) const { return color; }
61 virtual void setColorMap(const byte *colorMap) {}
62 virtual Common::Point getRealCoords(Common::Point &pos) const { return pos; }
63 virtual void setFlags(uint32 flags) {}
64 virtual void clearFlags(uint32 flags) {}
65 virtual bool supportsPalIntensity() const = 0;
66 virtual bool supportsHiResGraphics() const = 0;
67 virtual bool driverBasedTextRendering() const = 0;
68 uint16 numColors() const { return _numColors; }
69 byte pixelSize() const { return _pixelSize; }
70
71protected:
72 bool _ready;
73 static bool checkDriver(const char *const *driverNames, int listSize);
74 const uint16 _screenW;
75 const uint16 _screenH;
76 uint16 _numColors;
77 byte _pixelSize;
78};
79
80} // End of namespace Sci
81
82namespace SciGfxDriver {
83
84Common::RenderMode getRenderMode();
85Sci::GfxDriver *create(Common::RenderMode renderMode, int width, int height);
86
87} // End of namespace SciGfxDriver
88
89#endif // SCI_GRAPHICS_DRIVERS_GFXDRIVER_H
Definition: cursor.h:42
Definition: gfxdriver.h:39
RenderMode
Definition: rendermode.h:48
Definition: formatinfo.h:28
Definition: console.h:28
Definition: rect.h:144
Definition: rect.h:536
Definition: atari-cursor.h:35
Definition: pixelformat.h:138
Definition: helpers.h:269