ScummVM API documentation
fonttext.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 SLUDGE_FONTTEXT_H
22#define SLUDGE_FONTTEXT_H
23
24#include "common/hashmap.h"
25#include "common/ustr.h"
26
27#include "sludge/sprites.h"
28
29namespace Common {
30class SeekableReadStream;
31class WriteStream;
32}
33
34namespace Sludge {
35
36struct SpriteBank;
37class SpritePalette;
38
40public:
42 virtual ~TextManager();
43
44 void init();
45 void kill();
46
47 int stringWidth(const Common::String &theText);
48 int stringLength(const Common::String &theText);
49
50 bool loadFont(int filenum, const Common::String &charOrder, int);
51 void pasteString(const Common::String &theText, int, int, SpritePalette &);
52 void pasteStringToBackdrop(const Common::String &theText, int xOff, int y);
53 void burnStringToBackdrop(const Common::String &theText, int xOff, int y);
54 bool isInFont(const Common::String &theText);
55
56 // setter & getter
57 void setFontSpace(int fontSpace) { _fontSpace = fontSpace; }
58 int getFontHeight() const { return _fontHeight; }
59 void setPasterColor(byte r, byte g, byte b) { _pastePalette.setColor(r, g, b); }
60
61 // load & save
62 void saveFont(Common::WriteStream *stream);
63 void loadFont(int ssgVersion, Common::SeekableReadStream *stream);
64
65private:
66 SpriteBank _theFont;
67 int _fontHeight, _numFontColours, _loadedFontNum;
68 Common::U32String _fontOrder;
69 int16 _fontSpace;
70 SpritePalette _pastePalette;
71
73
74 inline uint32 fontInTable(uint32 x) { return _fontTable[x]; }
75
76};
77
78} // End of namespace Sludge
79
80#endif
Definition: stream.h:745
Definition: str.h:59
Definition: ustr.h:57
Definition: stream.h:77
Definition: sprites.h:34
Definition: fonttext.h:39
Definition: algorithm.h:29
Definition: sprites.h:78