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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef ASYLUM_SYSTEM_TEXT_H
24 #define ASYLUM_SYSTEM_TEXT_H
25 
26 #include "common/rect.h"
27 #include "common/scummsys.h"
28 
29 #include "asylum/shared.h"
30 
31 namespace Asylum {
32 
33 class AsylumEngine;
34 class GraphicResource;
35 class ResourcePack;
36 
37 enum TextCentering {
38 	kTextNormal,
39 	kTextCenter,
40 	kTextCalculate
41 };
42 
43 class Text {
44 public:
45 	Text(AsylumEngine *engine);
46 	~Text();
47 
48 	ResourceId loadFont(ResourceId resourceId);
49 
50 	void   setPosition(const Common::Point &point);
51 	int16  getWidth(char c);
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 drawChar(char 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 	int16 draw(int16 a1, int16 a2, TextCentering centering, const Common::Point &point, int16 spacing, int16 width, const char *text);
66 
67 	void drawCentered(const Common::Point &point, int16 width, const char *text);
68 	void drawCentered(const Common::Point &point, int16 width, ResourceId resourceId);
69 	void drawCentered(const Common::Point &point, int16 width, int16 length, const char *text);
70 
setTransTableNum(uint32 val)71 	void setTransTableNum(uint32 val) { _transTableNum = val; }
72 
73 private:
74 	AsylumEngine *_vm;
75 
76 	GraphicResource *_fontResource;
77 
78 	uint32 _transTableNum;
79 
80 	Common::Point _position;
81 	uint8 _curFontFlags;
82 
83 };
84 
85 } // end of namespace Asylum
86 
87 #endif // ASYLUM_SYSTEM_TEXT_H
88