ScummVM API documentation
typewritertext.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 NANCY_ACTION_TYPEWRITERTEXT_H
23#define NANCY_ACTION_TYPEWRITERTEXT_H
24
25#include "engines/nancy/action/actionrecord.h"
26
27namespace Nancy {
28namespace Action {
29
30// Nancy18. Writes an AUTOTEXT entry into a rectangle a few characters at a time,
31// with a key sound for every batch. An event flag gets set once it is all there.
33public:
35 virtual ~TypewriterText() {}
36
37 void init() override;
38
39 void readData(Common::SeekableReadStream &stream) override;
40 void execute() override;
41
42 bool isViewportRelative() const override { return true; }
43
44protected:
45 Common::String getRecordTypeName() const override { return "TypewriterText"; }
46
47 // Returns how many characters got added
48 uint typeCharacters(uint numCharacters);
49 void redraw();
50
51 // -- File data --
52 Common::String _textKey;
53 Common::Rect _bounds;
54 double _charactersPerSecond = 0;
55 uint32 _fontID = 0;
56 uint32 _colorID = 0;
57 RandomSoundBlock _keySound;
58 FlagDescription _doneFlag;
59
60 // -- Runtime state --
61 Common::String _text;
62 uint _numTypedCharacters = 0;
63 uint32 _lastTickTime = 0;
64 uint32 _pendingTicks = 0;
65};
66
67} // End of namespace Action
68} // End of namespace Nancy
69
70#endif // NANCY_ACTION_TYPEWRITERTEXT_H
Definition: stream.h:745
Definition: str.h:59
Definition: actionrecord.h:169
Definition: typewritertext.h:32
Definition: actionmanager.h:32
Definition: rect.h:536
Definition: commontypes.h:201
Definition: commontypes.h:324