ScummVM API documentation
talk.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/*
23 * This code is based on original Sfinx source code
24 * Copyright (c) 1994-1997 Janusz B. Wisniewski and L.K. Avalon
25 */
26
27#ifndef CGE2_TALK_H
28#define CGE2_TALK_H
29
30#include "cge2/general.h"
31#include "cge2/vga13h.h"
32
33namespace CGE2 {
34
35#define kTextHMargin (6&~1) // EVEN horizontal margins!
36#define kTextVMargin 5 // vertical margins
37#define kTextLineSpace 2 // line spacing
38#define kTextRoundCorner 3 // rounded corners
39#define kWidSize 256
40#define kPosSize 256
41#define kMapSize (256*8)
42#define kFontHigh 8
43#define kCaptionSide 24
44#define kInfName 101
45#define kSayName 102
46
47class Font {
48 void load();
49 CGE2Engine *_vm;
50public:
51 uint8 *_widthArr;
52 uint16 *_pos;
53 uint8 *_map;
54 uint8 _colorSet[kColorNum][4];
55 Font(CGE2Engine *vm);
56 ~Font();
57 uint16 width(const char *text);
58};
59
60enum TextBoxStyle { kTBPure, kTBRect, kTBRound };
61
62class Talk : public Sprite {
63protected:
64 TextBoxStyle _mode;
65 bool _created;
66 uint8 *box(V2D siz);
67 bool _wideSpace;
68public:
69 uint8 *_color;
70
71 Talk(CGE2Engine *vm, const char *text, TextBoxStyle mode = kTBPure, ColorBank color = kCBStd, bool wideSpace = false);
72 Talk(CGE2Engine *vm, ColorBank color = kCBStd);
73
74 void update(const char *text);
75private:
76 CGE2Engine *_vm;
77};
78
79class InfoLine : public Talk {
80 const char *_oldText, *_newText;
81public:
82 bool _realTime;
83 InfoLine(CGE2Engine *vm, uint16 wid, ColorBank color = kCBStd);
84 void update(const char *text);
85 void update() { update(_newText); }
86 void setText(const char *txt) { _newText = txt; }
87private:
88 CGE2Engine *_vm;
89};
90
91} // End of namespace CGE2
92
93#endif // CGE2_TALK_H
Definition: cge2.h:149
Definition: talk.h:47
Definition: talk.h:79
Definition: vga13h.h:152
Definition: talk.h:62
Definition: vga13h.h:94