ScummVM API documentation
graphics.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 WAYNESWORLD_GRAPHICS_H
23#define WAYNESWORLD_GRAPHICS_H
24
25#include "waynesworld/waynesworld.h"
26#include "graphics/surface.h"
27
28namespace WaynesWorld {
29
31public:
32 WWSurface(int width, int height);
33 WWSurface(const Graphics::Surface *sourceSurface);
34 ~WWSurface();
35
36 void drawSurface(const Graphics::Surface *surface, int x, int y);
37 void drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y);
38 void scaleSurface(const Graphics::Surface *surface);
39 void frameRect(int x1, int y1, int x2, int y2, byte color);
40 void fillSquare(int x, int y, int length, byte color);
41 void fillRect(int x1, int y1, int x2, int y2, byte color);
42 void clear(byte color);
43};
44
45class GFTFont {
46public:
47 GFTFont();
48 ~GFTFont();
49
50 void loadFromFile(const char *filename);
51 void drawText(Graphics::Surface *surface, const char *text, int x, int y, byte color);
52 void drawWrappedText(Graphics::Surface *surface, const char *text, int x, int y, int maxWidth, byte color);
53 int drawChar(Graphics::Surface *surface, byte ch, int x, int y, byte color);
54 int getTextWidth(const char *text) const;
55 int getCharWidth(byte ch) const;
56protected:
57 byte _firstChar = 0;
58 byte _lastChar = 0;
59 uint16 *_charTable = nullptr;
60 byte *_fontData = nullptr;
61 int16 _formWidth = 0;
62 int16 _formHeight = 0;
63};
64
65class Screen {
66public:
67 Graphics::Surface *_screenCopy = nullptr;
68
69 Screen();
70 ~Screen();
71
72 void beginUpdate();
73 void endUpdate();
74 void drawSurface(const Graphics::Surface *surface, int x, int y);
75 void drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y);
76 void frameRect(int x1, int y1, int x2, int y2, byte color);
77 void fillSquare(int x, int y, int length, byte color);
78 void fillRect(int x1, int y1, int x2, int y2, byte color);
79 void clear(byte color);
80 void drawText(GFTFont *font, const char *text, int x, int y, byte color);
81 void drawWrappedText(GFTFont *font, const char *text, int x, int y, int maxWidth, byte color);
82 void saveScreenshot();
83
84protected:
85 Graphics::Surface *_vgaSurface = nullptr;
86 int _lockCtr = 0;
87};
88
90public:
91 ScreenEffect(WaynesWorldEngine *vm, Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight);
92
93 void drawSpiralEffect();
94 void drawRandomEffect();
95protected:
97 Graphics::Surface *_surface;
98 int _x, _y;
99 int _grainWidth, _grainHeight;
100 int _blockCountW, _blockCountH;
101 int _blockCtr;
102 uint32 _timePerSlice;
103 uint32 _totalSliceTicks = 0;
104 int _blocksPerSlice;
105 void drawBlock(int blockX, int blockY);
106 static uint getBitCount(int value);
107 uint getSeed(uint bitCount) const;
108};
109
110} // End of namespace WaynesWorld
111
112#endif // WAYNESWORLD_GRAPHICS_H
Definition: graphics.h:45
Definition: graphics.h:89
Definition: graphics.h:65
Definition: graphics.h:30
Definition: waynesworld.h:112
Definition: surface.h:67