1// SuperTux
2// Copyright (C) 2006 Matthias Braun <matze@braunis.de>
3// 2018 Ingo Ruhnke <grumbel@gmail.com>
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18#ifndef HEADER_SUPERTUX_OBJECT_MUSIC_OBJECT_HPP
19#define HEADER_SUPERTUX_OBJECT_MUSIC_OBJECT_HPP
20
21#include "supertux/game_object.hpp"
22
23enum MusicType {
24 LEVEL_MUSIC,
25 HERRING_MUSIC,
26 HERRING_WARNING_MUSIC
27};
28
29class MusicObject : public GameObject
30{
31public:
32 MusicObject();
33 MusicObject(const ReaderMapping& mapping);
34
35 virtual void update(float dt_sec) override;
36 virtual void draw(DrawingContext& context) override;
37
38 virtual bool is_singleton() const override { return true; }
39
40 virtual std::string get_class() const override { return "music"; }
41 virtual std::string get_display_name() const override { return _("Music"); }
42 virtual const std::string get_icon_path() const override { return "images/engine/editor/music.png"; }
43
44 virtual ObjectSettings get_settings() override;
45
46 void play_music(MusicType musictype);
47 void resume_music();
48 MusicType get_music_type() const;
49
50 void set_music(const std::string& music);
51 std::string get_music() const;
52
53private:
54 MusicType m_currentmusic;
55 std::string m_music;
56
57private:
58 MusicObject(const MusicObject&) = delete;
59 MusicObject& operator=(const MusicObject&) = delete;
60};
61
62#endif
63
64/* EOF */
65