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 M4_SUBTITLES_H
23 #define M4_SUBTITLES_H
24 
25 #include "common/hashmap.h"
26 #include "video/subtitles.h"
27 
28 namespace Common {
29 class TranslationManager;
30 } // namespace Common
31 
32 namespace M4 {
33 
35 public:
36  M4Subtitles();
37  ~M4Subtitles();
38 
39  void drawSubtitle(const Common::String &audioFile) const;
40  void clearSubtitle() const override;
41  void updateSubtitleOverlay() const override;
42  bool shouldShowSubtitle() const override;
43  void load();
44 
45 private:
46  void setupSubtitles();
47  Common::String getSubtitle(const Common::String &audioFile) const;
48  int16 nudgeSubtitle() const;
49 
51  bool _subtitlesEnabled;
52  mutable int16 _subtitleYOffset = 0;
53 
54  // Font sizing constants (as percentage of screen height)
55  const int MIN_FONT_SIZE = 8;
56  const float BASE_FONT_SIZE_PERCENT = 0.023f; // ~50px at 2160p
57 
58 #ifdef USE_TRANSLATION
59  Common::TranslationManager *_transMan = nullptr;
60 #endif
61 };
62 
63 } // namespace M4
64 
65 #endif /* M4_SUBTITLES_H */
Definition: subtitles.h:34
Definition: str.h:59
Definition: subtitles.h:77
Definition: algorithm.h:29
Definition: translation.h:87
Definition: database.h:28