ScummVM API documentation
text.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 ASYLUM_SYSTEM_TEXT_H
23#define ASYLUM_SYSTEM_TEXT_H
24
25#include "common/ptr.h"
26#include "common/rect.h"
27#include "common/scummsys.h"
28#include "graphics/font.h"
29
30#include "asylum/shared.h"
31
32namespace Asylum {
33
34class AsylumEngine;
35class GraphicResource;
36class ResourcePack;
37
38enum TextCentering {
39 kTextNormal,
40 kTextCenter,
41 kTextCalculate
42};
43
44class Text {
45public:
46 Text(AsylumEngine *engine);
47 ~Text();
48
49 ResourceId loadFont(ResourceId resourceId);
50
51 void setPosition(const Common::Point &point);
52 int16 getWidth(const char *text);
53 int16 getWidth(const char *text, int16 length);
54 int16 getWidth(ResourceId resourceId);
55 char *get(ResourceId resourceId);
56
57 void drawASCII(char character) { drawChar(character); }
58 void draw(const char *text);
59 void draw(const Common::Point &point, const char *text);
60 void draw(ResourceId resourceId);
61 void draw(const Common::Point &point, ResourceId resourceId);
62 void draw(const char *text, ResourceId fontResourceId, int16 y);
63 void draw(const char *text, int16 length);
64 int16 draw(TextCentering centering, const Common::Point &point, int16 spacing, int16 width, const char *text);
65 void drawChinese(const Common::U32String &utext);
66 int16 draw(int16 a1, int16 a2, TextCentering centering, const Common::Point &point, int16 spacing, int16 width, const char *text);
67
68 void drawCentered(const Common::Point &point, int16 width, const char *text);
69 void drawCentered(const Common::Point &point, int16 width, ResourceId resourceId);
70 void drawCentered(const Common::Point &point, int16 width, int16 length, const char *text);
71
72 void setTransTableNum(uint32 val) { _transTableNum = val; }
73
74private:
75 int16 getWidth(char c);
76 void drawChar(char character);
77
78 int16 getChineseWidth(const Common::U32String &utext);
79 void loadChineseFont();
80
81 AsylumEngine *_vm;
82
83 GraphicResource *_fontResource;
84
85 uint32 _transTableNum;
86
87 Common::Point _position;
88 uint8 _curFontFlags;
89
91 bool _chineseFontLoadAttempted;
92};
93
94} // end of namespace Asylum
95
96#endif // ASYLUM_SYSTEM_TEXT_H
Definition: asylum.h:73
Definition: graphics.h:58
Definition: text.h:44
Definition: ustr.h:57
Definition: rect.h:144