ScummVM API documentation
charset.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 ULTIMA3_GFX_CHARSET_H
23#define ULTIMA3_GFX_CHARSET_H
24
25#include "graphics/font.h"
26#include "graphics/managed_surface.h"
27
28namespace Ultima {
29namespace Ultima3 {
30namespace Gfx {
31
32constexpr int CHARSET_TEXT_GLYPHS = 128;
33constexpr int CHARSET_MOON_GLYPHS = 8;
34constexpr int CHARSET_GLYPHS = CHARSET_TEXT_GLYPHS + CHARSET_MOON_GLYPHS;
35constexpr int CHARSET_GLYPH_PIXELS = 8 * 8;
36
43class CharSet : public Graphics::Font {
44private:
45 static byte _data[CHARSET_GLYPHS * CHARSET_GLYPH_PIXELS];
46
47public:
48 static void load();
49
53 static uint32 moonIcon(byte phase) {
54 return CHARSET_TEXT_GLYPHS + ((phase - 1) & (CHARSET_MOON_GLYPHS - 1));
55 }
56
57public:
63 int getFontHeight() const override {
64 return 8;
65 }
66
72 int getMaxCharWidth() const override {
73 return 8;
74 }
75
83 int getCharWidth(uint32) const override {
84 return 8;
85 }
86
96 void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override;
97};
98
99} // namespace Gfx
100} // namespace Ultima3
101} // namespace Ultima
102
103#endif
Definition: font.h:83
Definition: charset.h:43
void drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 color) const override
int getFontHeight() const override
Definition: charset.h:63
int getCharWidth(uint32) const override
Definition: charset.h:83
int getMaxCharWidth() const override
Definition: charset.h:72
static uint32 moonIcon(byte phase)
Definition: charset.h:53
Definition: surface.h:67