ScummVM API documentation
font.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 #ifndef DRAGONS_FONT_H
22 #define DRAGONS_FONT_H
23 
24 #include "common/scummsys.h"
25 #include "common/stream.h"
26 #include "graphics/surface.h"
27 
28 namespace Dragons {
29 
30 class DragonsEngine;
31 class BigfileArchive;
32 class Screen;
33 
34 class Font {
35 private:
36  uint32 _size;
37  uint16 *_map;
38  byte *_pixels;
39  uint32 _numChars;
40 
41 public:
42  Font(Common::SeekableReadStream &stream, uint32 mapSize, uint32 pixelOffset, uint32 pixelSize);
43  ~Font();
44  Graphics::Surface *render(uint16 *text, uint16 length);
45  void renderToSurface(Graphics::Surface *surface, int16 x, int16 y, uint16 *text, uint16 length);
46 
47 private:
48  uint16 mapChar(uint16 in);
49 };
50 
51 class FontManager {
52 public:
53  Font *_fonts[3];
54 
55 private:
56  uint16 _dat_80086f48_fontColor_flag;
57  DragonsEngine *_vm;
58  Screen *_screen;
59  Graphics::Surface *_surface;
60  byte *_boxFontChr;
61 
62  int _numTextEntries;
63 
64 public:
65  FontManager(DragonsEngine *vm, Screen *screen, BigfileArchive *bigfileArchive);
66  ~FontManager();
67  void addText(int16 x, int16 y, uint16 *text, uint16 length, uint8 fontType);
68  void addAsciiText(int16 x, int16 y, const char *text, uint16 length, uint8 fontType);
69  void draw();
70  void clearText();
71  void updatePalette();
72  void drawTextDialogBox(uint32 x1, uint32 y1, uint32 x2, uint32 y2);
73  void clearTextDialog(uint32 x1, uint32 y1, uint32 x2, uint32 y2);
74 
75 private:
76  Font *loadFont(uint16 index, Common::SeekableReadStream &stream);
77  void drawBoxChar(uint32 x, uint32 y, uint8 tileIndex);
78 };
79 
80 } // End of namespace Dragons
81 
82 #endif //DRAGONS_FONT_H
Definition: surface.h:67
Definition: bigfile.h:42
Definition: atari-screen.h:58
Definition: stream.h:745
Definition: screen.h:67
Definition: font.h:34
Definition: actor.h:28
Definition: font.h:51
Definition: dragons.h:166