ScummVM API documentation
txtfile.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 * This file is dual-licensed.
22 * In addition to the GPLv3 license mentioned above, this code is also
23 * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24 * full text of the license.
25 *
26 */
27
28#ifndef GOB_PREGOB_TXTFILE_H
29#define GOB_PREGOB_TXTFILE_H
30
31#include "common/system.h"
32#include "common/str.h"
33#include "common/array.h"
34
35#include "gob/backbuffer.h"
36
37namespace Common {
38 class SeekableReadStream;
39}
40
41namespace Gob {
42
43class Surface;
44class Font;
45
46class TXTFile : public BackBuffer {
47public:
48 enum Format {
49 kFormatString,
50 kFormatStringPosition,
51 kFormatStringPositionColor,
52 kFormatStringPositionColorFont
53 };
54
55 struct Line {
56 Common::String text;
57 int x, y;
58 int color;
59 uint font;
60 };
61
63
64 TXTFile(Common::SeekableReadStream &txt, Format format);
65 ~TXTFile();
66
67 LineArray &getLines();
68
69 bool draw( Surface &surface, const Font * const *fonts, uint fontCount, int color = -1);
70 bool draw(uint line, Surface &surface, const Font * const *fonts, uint fontCount, int color = -1);
71
72 bool draw( Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom,
73 const Font * const *fonts, uint fontCount, int color = -1);
74 bool draw(uint line, Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom,
75 const Font * const *fonts, uint fontCount, int color = -1);
76
77 bool clear(Surface &surface, int16 &left, int16 &top, int16 &right, int16 &bottom);
78
79private:
80 LineArray _lines;
81
82 void load(Common::SeekableReadStream &txt, Format format);
83
85 int getInt(Common::SeekableReadStream &txt);
86
87
88 bool getArea( int16 &left, int16 &top, int16 &right, int16 &bottom,
89 const Font * const *fonts, uint fontCount) const;
90 bool getArea(uint line, int16 &left, int16 &top, int16 &right, int16 &bottom,
91 const Font * const *fonts, uint fontCount) const;
92};
93
94} // End of namespace Gob
95
96#endif // GOB_PREGOB_TXTFILE_H
Definition: stream.h:745
Definition: str.h:59
Definition: backbuffer.h:37
Definition: video.h:40
Definition: surface.h:106
Definition: txtfile.h:46
Definition: algorithm.h:29
Definition: txtfile.h:55