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 KYRA_TEXT_H
23 #define KYRA_TEXT_H
24 
25 #include "common/scummsys.h"
26 
27 #include "kyra/graphics/screen.h"
28 
29 namespace Kyra {
30 class KyraEngine_v1;
31 
33 public:
34  TextDisplayer(KyraEngine_v1 *vm, Screen *screen);
35  virtual ~TextDisplayer() {}
36 
37  int maxSubstringLen() const { return TALK_SUBSTRING_LEN; }
38 
39  void setTalkCoords(uint16 y);
40  int getCenterStringX(const Common::String &str, int x1, int x2);
41  int getCharLength(const char *str, int len);
42  int dropCRIntoString(char *str, int offs);
43  virtual char *preprocessString(const char *str);
44  int buildMessageSubstrings(const char *str);
45  int getWidestLineWidth(int linesCount);
46  virtual void calcWidestLineBounds(int &x1, int &x2, int w, int cx);
47  virtual void restoreTalkTextMessageBkgd(int srcPage, int dstPage);
48  void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage);
49  virtual void printText(const Common::String &str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
50  void printCharacterText(const char *text, int8 charNum, int charX);
51 
52  uint16 _talkMessageY;
53  uint16 _talkMessageH;
54  int _langExtraSpacing;
55  bool printed() const { return _talkMessagePrinted; }
56 
57 protected:
58  Screen *_screen;
59  KyraEngine_v1 *_vm;
60 
61  struct TalkCoords {
62  uint16 y, x, w;
63  };
64 
65  // TODO: AMIGA and LoK specific, move to a better location
66  void setTextColor(uint8 color);
67 
68  enum {
69  TALK_SUBSTRING_LEN = 80,
70  TALK_SUBSTRING_NUM = 6
71  };
72 
73  char _talkBuffer[1040];
74  char _talkSubstrings[TALK_SUBSTRING_LEN * TALK_SUBSTRING_NUM];
75  TalkCoords _talkCoords;
76  bool _talkMessagePrinted;
77 
78  char _lineBreakChar;
79 };
80 
81 } // End of namespace Kyra
82 
83 #endif
Definition: str.h:59
Definition: text.h:32
Definition: text.h:61
Definition: kyra_v1.h:126
Definition: screen.h:565
Definition: detection.h:27