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