ScummVM API documentation
subtitle.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 LASTEXPRESS_SUBTITLE_H
23 #define LASTEXPRESS_SUBTITLE_H
24 
25 /*
26  Subtitle format (.SBE)
27 
28  uint16 {2} - number of subtitles
29 
30  // for each subtitle
31  uint16 {2} - display start time
32  uint16 {2} - display stop time
33  uint16 {2} - top line length
34  uint16 {2} - bottom line length
35  byte {x} - top line (UTF-16 string)
36  byte {x} - bottom line (UTF-16 string)
37 
38  Subtitles seem to be drawn on screen at (80, 420) x (560, 458)
39 */
40 
41 #include "lastexpress/drawable.h"
42 
43 #include "common/array.h"
44 
45 namespace Common {
46 class SeekableReadStream;
47 }
48 
49 namespace LastExpress {
50 
51 class Font;
52 class Subtitle;
53 
54 class SubtitleManager : public Drawable {
55 public:
56  SubtitleManager(Font *font);
57  ~SubtitleManager() override;
58 
59  bool load(Common::SeekableReadStream *stream);
60  uint16 getMaxTime() const;
61  void setTime(uint16 time);
62  bool hasChanged() const;
63  Common::Rect draw(Graphics::Surface *surface) override;
64 
65 private:
66  Common::Array<Subtitle *> _subtitles;
67  Font *_font;
68  uint16 _maxTime;
69 
70  int16 _currentIndex;
71  int16 _lastIndex;
72 
73  void reset();
74 };
75 
76 } // End of namespace LastExpress
77 
78 #endif // LASTEXPRESS_SUBTITLE_H
Definition: font.h:48
Definition: surface.h:67
Definition: subtitle.h:54
Definition: array.h:52
Definition: rect.h:144
Definition: stream.h:745
Definition: animation.h:45
Definition: drawable.h:29
Definition: algorithm.h:29