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 SWORD1_TEXT_H
23#define SWORD1_TEXT_H
24
25#include "sword1/object.h"
26#include "sword1/sworddefs.h"
27
28namespace Sword1 {
29
30#define MAX_TEXT_OBS 3
31
32#define BORDER_COL 200
33#define BORDER_COL_PSX 199
34#define LETTER_COL 193
35#define NO_COL 0 // sprite background - 0 for transparency
36
37class ObjectMan;
38class ResMan;
39class Screen;
40class Logic;
41class SwordEngine;
42
43struct LineInfo {
44 uint16 width; // width of line in pixels
45 uint16 length; // length of line in characters
46};
47
48class Text {
49public:
50 Text(SwordEngine *vm, Logic *pLogic, ObjectMan *pObjMan, ResMan *pResMan, Screen *pScreen, bool czechVersion);
51 ~Text();
52 FrameHeader *giveSpriteData(uint32 textTarget);
53 uint32 lowTextManager(uint8 *text, int32 width, uint8 pen);
54 void makeTextSprite(uint8 slot, const uint8 *text, uint16 maxWidth, uint8 pen);
55 void releaseText(uint32 id, bool updateCount = true);
56 void printDebugLine(uint8 *ascii, uint8 first, int x, int y);
57
58private:
59 uint16 analyzeSentence(const uint8 *text, uint16 maxWidth, LineInfo *info);
60 uint16 charWidth(uint8 ch);
61 uint16 wCharWidth(uint8 hi, uint8 lo);
62 uint16 copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen);
63 uint16 copyWChar(uint8 hi, uint8 lo, uint8 *sprPtr, uint16 sprWidth, uint8 pen);
64 bool isKoreanChar(uint8 hi, uint8 lo);
65
66 uint8 *_font;
67 uint8 _textCount;
68 uint16 _charHeight, _joinWidth;
69 SwordEngine *_vm;
70 Logic *_logic;
71 ObjectMan *_objMan;
72 ResMan *_resMan;
73 Screen *_screen;
74 FrameHeader *_textBlocks[MAX_TEXT_OBS];
75 uint32 _fontId;
76};
77
78} // End of namespace Sword1
79
80#endif //BSTEXT_H
Definition: logic.h:55
Definition: objectman.h:33
Definition: resman.h:65
Definition: screen.h:75
Definition: sword1.h:104
Definition: text.h:48
Definition: animation.h:38
Definition: atari-screen.h:58
Definition: sworddefs.h:108
Definition: text.h:43