ScummVM API documentation
driver.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 STARK_GFX_DRIVER_H
23 #define STARK_GFX_DRIVER_H
24 
25 #include "common/rect.h"
26 #include "graphics/pixelformat.h"
27 
28 namespace Graphics {
29 struct Surface;
30 }
31 
32 namespace Stark {
33 
34 class VisualActor;
35 class VisualProp;
36 
37 namespace Gfx {
38 
39 class SurfaceRenderer;
40 class FadeRenderer;
41 class Bitmap;
42 class Texture;
43 
44 class Driver {
45 public:
46  static Driver *create();
47 
48  virtual ~Driver() {}
49 
50  virtual void init() = 0;
51 
52  bool computeScreenViewport();
53  virtual void setScreenViewport(bool noScaling) = 0; // deprecated
54 
55  virtual void setViewport(const Common::Rect &rect) = 0;
56 
58  Common::Rect getScreenViewport() { return _screenViewport; }
59 
60  Common::Rect gameViewport() const;
61 
62  virtual void clearScreen() = 0;
63  virtual void flipBuffer() = 0;
64 
71  virtual Texture *createTexture() = 0;
72 
79  virtual Bitmap *createBitmap(const Graphics::Surface *surface = nullptr, const byte *palette = nullptr) = 0;
80 
86  virtual VisualActor *createActorRenderer() = 0;
87 
93  virtual VisualProp *createPropRenderer() = 0;
94 
100  virtual SurfaceRenderer *createSurfaceRenderer() = 0;
101 
107  virtual FadeRenderer *createFadeRenderer() = 0;
108 
110  bool isPosInScreenBounds(const Common::Point &point) const;
111 
113  Common::Point convertCoordinateCurrentToOriginal(const Common::Point &point) const;
114 
116  uint scaleWidthOriginalToCurrent(uint width) const;
117 
119  uint scaleHeightOriginalToCurrent(uint height) const;
120 
122  uint scaleWidthCurrentToOriginal(uint width) const;
123 
125  uint scaleHeightCurrentToOriginal(uint width) const;
126 
136  static const Graphics::PixelFormat getRGBAPixelFormat();
137 
139  virtual Graphics::Surface *getViewportScreenshot() const = 0;
140 
141  virtual void set3DMode() = 0;
142  virtual bool computeLightsEnabled() = 0;
143 
144  virtual bool supportsModdedAssets() const { return true; }
145 
146  static const int32 kOriginalWidth = 640;
147  static const int32 kOriginalHeight = 480;
148 
149  static const int32 kTopBorderHeight = 36;
150  static const int32 kGameViewportHeight = 365;
151  static const int32 kBottomBorderHeight = 79;
152 
153  static const int32 kGameViewportWidth = 640;
154 
155 protected:
156  static void flipVertical(Graphics::Surface *s);
157 
158  Common::Rect _screenViewport;
159  bool _computeLights;
160 };
161 
162 } // End of namespace Gfx
163 } // End of namespace Stark
164 
165 #endif // STARK_GFX_DRIVER_H
Definition: surface.h:67
Definition: pixelformat.h:138
Definition: rect.h:144
Definition: surfacerenderer.h:36
Definition: driver.h:44
Common::Rect getScreenViewport()
Definition: driver.h:58
Definition: texture.h:37
Definition: actor.h:50
Definition: console.h:27
Definition: bitmap.h:38
Definition: faderenderer.h:31
Definition: formatinfo.h:28
Definition: rect.h:45
Definition: prop.h:42