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 ZVISION_TTYTEXT_NODE_H
24 #define ZVISION_TTYTEXT_NODE_H
25 
26 #include "common/rect.h"
27 #include "graphics/surface.h"
28 
29 #include "zvision/scripting/scripting_effect.h"
30 #include "zvision/text/text.h"
31 #include "zvision/text/truetype_font.h"
32 
33 namespace Common {
34 class String;
35 }
36 
37 namespace ZVision {
38 class ttyTextNode : public ScriptingEffect {
39 public:
40 	ttyTextNode(ZVision *engine, uint32 key, const Common::String &file, const Common::Rect &r, int32 delay);
41 	~ttyTextNode() override;
42 
43 	/**
44 	 * Decrement the timer by the delta time. If the timer is finished, set the status
45 	 * in _globalState and let this node be deleted
46 	 *
47 	 * @param deltaTimeInMillis    The number of milliseconds that have passed since last frame
48 	 * @return                     If true, the node can be deleted after process() finishes
49 	 */
50 	bool process(uint32 deltaTimeInMillis) override;
51 private:
52 	Common::Rect _r;
53 
54 	TextStyleState _state;
55 	StyledTTFont _fnt;
56 	Common::String _txtbuf;
57 	uint32 _txtpos;
58 
59 	int32 _delay;
60 	int32 _nexttime;
61 	Graphics::Surface _img;
62 	int16 _dx;
63 	int16 _dy;
64 private:
65 
66 	void newline();
67 	void scroll();
68 	void outchar(uint16 chr);
69 };
70 
71 } // End of namespace ZVision
72 
73 #endif
74