ScummVM API documentation
textLayout.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 TEXT_LAYOUT_H
23 #define TEXT_LAYOUT_H
24 
25 #include "common/array.h"
26 #include "common/rect.h"
27 #include "common/scummsys.h"
28 #include "common/str.h"
29 
30 namespace Graphics {
31 struct Surface;
32 }
33 
34 namespace AGDS {
35 
36 class AGDSEngine;
37 class Process;
38 
39 class TextLayout {
40  int _fontId;
41  Common::Point _pos;
42  bool _npc;
43  bool _valid;
44 
45  struct Line {
46  Common::Point pos;
47  Common::String text;
48  Common::Point size;
49  };
50 
51  Common::Array<Line> _lines;
52 
53  Common::String _process;
54  Common::String _charNotifyVar;
55  Common::String _charDirectionNotifyVar;
56  Common::String _npcNotifyVar;
57 
58 public:
59  TextLayout() : _fontId(-1), _npc(true), _valid(false) {}
60 
61  bool valid() const {
62  return _valid;
63  }
64 
65  void reset(AGDSEngine &engine);
66 
67  void setCharNotifyVar(const Common::String &name) {
68  _charNotifyVar = name;
69  }
70 
71  void setCharDirectionNotifyVar(const Common::String &name) {
72  _charDirectionNotifyVar = name;
73  }
74 
75  void setNPCNotifyVar(const Common::String &name) {
76  _npcNotifyVar = name;
77  }
78 
79  void paint(AGDSEngine &engine, Graphics::Surface &backbuffer);
80  void layout(AGDSEngine &engine, Process &process, const Common::String &text, Common::Point pos, int fontId, bool npc);
81 };
82 
83 } // End of namespace AGDS
84 
85 #endif /* AGDS_TEXT_LAYOUT_H */
Definition: str.h:59
Definition: surface.h:67
Definition: textLayout.h:39
Definition: agds.h:58
Definition: formatinfo.h:28
Definition: rect.h:144
Definition: agds.h:81
Definition: process.h:39