Debian Codegraph @

src/gengine/Dialog.h

raw
1 #ifndef HEADER_DIALOG_H
2 #define HEADER_DIALOG_H
3
4 #include "NoCopy.h"
5 #include "StringTool.h"
6
7 #include "SDL_mixer.h"
8 #include <string>
9
10 /**
11 * Dialog with sound and subtitle.
12 * Dialog is const class only sound is lazy loaded.
13 */
14 class Dialog: public NoCopy {
15 public:
16 static const std::string DEFAULT_LANG;
17 private:
18 mutable Mix_Chunk *m_sound;
19 std::string m_soundfile;
20 std::string m_lang;
21 std::string m_subtitle;
22 public:
23 Dialog(const std::string &lang,
24 const std::string &soundfile, const std::string &subtitle);
25 virtual ~Dialog();
26
27 bool isSpeechless() const { return m_soundfile.empty(); }
28 int talk(int volume, int loops=0) const;
29 virtual void runSubtitle(const StringTool::t_args &args) const;
30 std::string getLang() const { return m_lang; }
31 std::string getSubtitle() const { return m_subtitle; }
32 std::string getFormatedSubtitle(const StringTool::t_args &args) const;
33 int getMinTime() const;
34
35 bool equalSound(const Mix_Chunk *other) const
36 { return m_sound == other; }
37 };
38
39 #endif
40