ScummVM API documentation
hotspot_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 #ifndef GRAPHICS_HOTSPOT_RENDERER_H
23 #define GRAPHICS_HOTSPOT_RENDERER_H
24 
25 #include "common/array.h"
26 #include "common/rect.h"
27 #include "common/ustr.h"
28 
29 namespace Graphics {
30 
31 class Font;
32 struct Surface;
33 struct PixelFormat;
34 
43 };
44 
48 struct HotspotInfo {
52 
53  HotspotInfo() : type(kHotspotDefault) {}
54  HotspotInfo(const Common::Point &pos, const Common::U32String &n,
56  : position(pos), name(n), type(t) {}
57 };
58 
63  kMarkerCrosshair,
64  kMarkerSquare,
65  kMarkerPoint
66 };
67 
72 public:
74  ~HotspotRenderer();
75 
89  void render(Surface *surface,
90  const Common::Array<HotspotInfo> &hotspots,
91  int gameWidth, int gameHeight,
92  int overlayWidth, int overlayHeight,
93  const PixelFormat &format,
94  MarkerShape markerShape,
95  bool showText);
96 
97 private:
98  enum {
99  kBaseMarkerSize = 10,
100  kBasePointRadius = 3,
101  kBaseLineThickness = 1
102  };
103 
104  float _sizeScale;
105  int _markerSize;
106  int _pointRadius;
107  int _lineThickness;
108 
109  void drawMarker(Surface *surface, int x, int y, const PixelFormat &format, MarkerShape markerShape);
110  void drawCrosshairMarker(Surface *surface, int x, int y, int width, int height, const PixelFormat &format);
111  void drawSquareMarker(Surface *surface, int x, int y, int width, int height, const PixelFormat &format);
112  void drawPointMarker(Surface *surface, int x, int y, int width, int height, const PixelFormat &format);
113  void drawHotspotLabel(Surface *surface, int overlayX, int overlayY, const Common::U32String &label,
114  int overlayWidth, int overlayHeight, const PixelFormat &format, const Font *font);
115  void drawLabelBox(Surface *surface, int x, int y, int w, int h,
116  int overlayWidth, int overlayHeight, const PixelFormat &format);
117  void drawRect(Surface *surface, int x, int y, int w, int h,
118  int overlayWidth, int overlayHeight, const PixelFormat &format);
119 
120  void drawLine(Surface *surface, int x1, int y1, int x2, int y2,
121  int width, int height, const PixelFormat &format, int lineThickness);
122 
123  void blendPixel(Surface *surface, int px, int py, const PixelFormat &format,
124  int distance, int solidSize);
125 };
126 
127 } // End of namespace Graphics
128 
129 #endif // GRAPHICS_HOTSPOT_RENDERER_H
Definition: font.h:83
Definition: surface.h:67
Common::U32String name
Display name.
Definition: hotspot_renderer.h:50
HotspotType type
Classification of the hotspot.
Definition: hotspot_renderer.h:51
MarkerShape
Definition: hotspot_renderer.h:62
Definition: array.h:52
Definition: pixelformat.h:138
Interactable object.
Definition: hotspot_renderer.h:40
Definition: hotspot_renderer.h:71
Definition: ustr.h:57
Non-player character.
Definition: hotspot_renderer.h:42
Definition: formatinfo.h:28
Definition: rect.h:144
Common::Point position
Position in game coordinates.
Definition: hotspot_renderer.h:49
HotspotType
Definition: hotspot_renderer.h:38
Exit or door leading to another area.
Definition: hotspot_renderer.h:41
No specific type (generic / unclassified)
Definition: hotspot_renderer.h:39
Definition: hotspot_renderer.h:48