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 SUBTITLES_H_
23 #define SUBTITLES_H_
24 
25 #include "engines/myst3/gfx.h"
26 
27 #include "common/array.h"
28 
29 namespace Myst3 {
30 
31 class Myst3Engine;
32 class ResourceDescription;
33 
34 class Subtitles : public Window {
35 public:
36  static Subtitles *create(Myst3Engine *vm, uint32 id);
37  virtual ~Subtitles();
38 
39  // Window API
40  Common::Rect getPosition() const override;
41  Common::Rect getOriginalPosition() const override;
42 
43  void setFrame(int32 frame);
44  void drawOverlay() override;
45 
46 protected:
47  struct Phrase {
48  uint32 offset;
49  int32 frame;
50  Common::String string;
51  };
52 
54 
55  void loadFontSettings(int32 id);
56  virtual void loadResources() = 0;
57  virtual bool loadSubtitles(int32 id) = 0;
58  virtual void drawToTexture(const Phrase *phrase) = 0;
59  void freeTexture();
60 
61  int32 checkOverridenId(int32 id);
62  ResourceDescription loadText(int32 id, bool overriden);
63 
64  Myst3Engine *_vm;
65 
66  Common::Array<Phrase> _phrases;
67 
68  int32 _frame;
69  Texture *_texture;
70 
71  // Font settings
72  Common::String _fontFace;
73  uint _fontSize;
74  bool _fontBold;
75  uint _surfaceHeight;
76  uint _singleLineTop;
77  uint _line1Top;
78  uint _line2Top;
79  uint _surfaceTop;
80  int32 _fontCharsetCode;
81 };
82 
83 } // End of namespace Myst3
84 
85 #endif // SUBTITLES_H_
Definition: str.h:59
Definition: subtitles.h:47
Definition: array.h:52
Common::Rect getOriginalPosition() const override
Definition: ambient.h:27
Definition: rect.h:144
Definition: gfx.h:93
Definition: gfx.h:65
Definition: myst3.h:87
Common::Rect getPosition() const override
Definition: archive.h:105
Definition: subtitles.h:34