ScummVM API documentation
base_renderer.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  * This file is based on WME Lite.
24  * http://dead-code.org/redir.php?target=wmelite
25  * Copyright (c) 2011 Jan Nedoma
26  */
27 
28 #ifndef WINTERMUTE_BASE_RENDERER_H
29 #define WINTERMUTE_BASE_RENDERER_H
30 
31 #include "engines/wintermute/base/base.h"
32 #include "engines/wintermute/coll_templ.h"
33 
34 #include "common/rect.h"
35 #include "common/array.h"
36 
37 namespace Wintermute {
38 
39 class BaseImage;
40 class BaseActiveRect;
41 class BaseObject;
42 class BaseSurface;
43 class BasePersistenceManager;
44 #ifdef ENABLE_WME3D
45 class Camera3D;
46 #endif
47 
53 class BaseRenderer : public BaseClass {
54 public:
55  int _realWidth;
56  int _realHeight;
57  int _drawOffsetX;
58  int _drawOffsetY;
59 
60  void dumpData(const char *filename) {};
66  virtual BaseImage *takeScreenshot(int newWidth = 0, int newHeight = 0) = 0;
67  virtual bool setViewport(int left, int top, int right, int bottom);
68  virtual bool setViewport(Common::Rect32 *rect);
69  virtual bool setScreenViewport();
70  virtual void setWindowed(bool windowed) = 0;
71 
72  virtual Graphics::PixelFormat getPixelFormat() const = 0;
78  virtual bool fade(uint16 alpha) = 0;
88  virtual bool fadeToColor(byte r, byte g, byte b, byte a) = 0;
89 
90  virtual bool drawLine(int x1, int y1, int x2, int y2, uint32 color);
91  virtual bool drawRect(int x1, int y1, int x2, int y2, uint32 color, int width = 1);
92  virtual bool fillRect(int x, int y, int w, int h, uint32 color); // Unused outside indicator-display
93  BaseRenderer(BaseGame *inGame = nullptr);
94  ~BaseRenderer() override;
95  virtual bool setProjection() {
96  return STATUS_OK;
97  };
98 
99  virtual bool windowedBlt();
103  virtual bool clear() = 0;
104  virtual void onWindowChange();
105  virtual bool initRenderer(int width, int height, bool windowed);
112  virtual bool flip() = 0;
117  virtual bool indicatorFlip(int32 x, int32 y, int32 width, int32 height) = 0;
118  virtual bool forcedFlip() = 0;
119  virtual void initLoop();
120  virtual bool setup2D(bool force = false);
121 #ifdef ENABLE_WME3D
122  virtual bool setup3D(Camera3D *camera = nullptr, bool force = false);
123 #endif
124 
130  virtual Common::String getName() const = 0;
131  virtual bool displayDebugInfo() {
132  return STATUS_FAILED;
133  };
134  virtual bool drawShaderQuad() {
135  return STATUS_FAILED;
136  }
137 
138  virtual float getScaleRatioX() const {
139  return 1.0f;
140  }
141  virtual float getScaleRatioY() const {
142  return 1.0f;
143  }
144 
153  virtual BaseSurface *createSurface() = 0;
154 
155  bool clipCursor();
156  bool unclipCursor();
157 
158  BaseObject *getObjectAt(int x, int y);
159  void deleteRectList();
160 
161  virtual bool startSpriteBatch() {
162  return STATUS_OK;
163  };
164  virtual bool endSpriteBatch() {
165  return STATUS_OK;
166  };
167  bool pointInViewport(Common::Point32 *P);
168  uint32 _forceAlphaColor;
169  uint32 _window;
170  uint32 _clipperWindow;
171  bool _active;
172  bool _ready;
173 
174  bool isReady() const { return _ready; }
175  bool isWindowed() const { return _windowed; }
176  int32 getBPP() const { return _bPP; }
177  int32 getWidth() const { return _width; }
178  int32 getHeight() const { return _height; }
179 
180  virtual void endSaveLoad() {};
181 
182  bool _windowed;
183 
184  Common::Rect32 _windowRect;
185  Common::Rect32 _viewportRect;
186  Common::Rect32 _screenRect;
187  Common::Rect32 _monitorRect;
188  int32 _bPP;
189  int32 _height;
190  int32 _width;
191 
192  BaseArray<BaseActiveRect *> _rectList;
193 };
194 
195 BaseRenderer *makeOSystemRenderer(BaseGame *inGame);
196 #ifdef ENABLE_WME3D
197 class BaseRenderer3D;
198 
199 BaseRenderer3D *makeOpenGL3DRenderer(BaseGame *inGame);
200 BaseRenderer3D *makeOpenGL3DShaderRenderer(BaseGame *inGame);
201 BaseRenderer3D *makeTinyGL3DRenderer(BaseGame *inGame);
202 #endif
203 
204 } // End of namespace Wintermute
205 
206 #endif
Definition: base_game.h:79
Definition: rect.h:526
Definition: str.h:59
virtual Common::String getName() const =0
Definition: base_image.h:45
Definition: pixelformat.h:138
virtual BaseSurface * createSurface()=0
virtual bool fade(uint16 alpha)=0
virtual bool clear()=0
virtual BaseImage * takeScreenshot(int newWidth=0, int newHeight=0)=0
virtual bool indicatorFlip(int32 x, int32 y, int32 width, int32 height)=0
virtual bool fadeToColor(byte r, byte g, byte b, byte a)=0
Definition: base_surface.h:37
Definition: rect.h:146
Definition: base_renderer3d.h:60
Definition: coll_templ.h:347
Definition: base_renderer.h:53
Definition: base.h:43
virtual bool flip()=0
Definition: 3dcamera.h:38
Definition: base_object.h:49
Definition: achievements_tables.h:27