ScummVM API documentation
subtitles.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 NEVERHOOD_SUBTITLES_H
23 #define NEVERHOOD_SUBTITLES_H
24 
25 #include "common/str.h"
26 #include "neverhood/neverhood.h"
27 #include "graphics/surface.h"
28 
29 namespace Neverhood {
30 
31 struct Subtitle {
32  uint32 fromFrame;
33  uint32 toFrame;
34  Common::String text;
35  bool isTop;
36 };
37 
39 public:
40  SubtitlePlayer(NeverhoodEngine *vm, uint32 fileHash, int width);
41 
42  void renderFrame(uint frameNumber, int centerX);
43  const Graphics::Surface *getBottomSubs() const { return _haveBottomSubs ? &_bottomSubs : nullptr; }
44  const Graphics::Surface *getTopSubs() const { return _haveTopSubs ? &_topSubs : nullptr; }
45  bool isValid() const { return _isValid && !_subtitles.empty(); }
46  byte getSubtitleAlpha() const { return _alphaColor; }
47 
48  static const int kSubtitleCharHeight = 16;
49  static const int kSubtitleCharWidth = 8;
50 
51 private:
52  NeverhoodEngine *_vm;
53  bool _isValid;
54  Common::Array<Subtitle> _subtitles;
55  Graphics::Surface _bottomSubs;
56  Graphics::Surface _topSubs;
57  bool _haveBottomSubs;
58  bool _haveTopSubs;
59  int64 _currentFrame;
60  byte _alphaColor;
61 };
62 
63 } // End of namespace Neverhood
64 
65 #endif /* NEVERHOOD_SUBTITLES_H */
Definition: background.h:30
Definition: str.h:59
Definition: surface.h:67
Definition: neverhood.h:60
Definition: array.h:52
Definition: subtitles.h:38
Definition: subtitles.h:31