diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/events.hpp | 9 | ||||
-rw-r--r-- | include/world.hpp | 21 |
2 files changed, 14 insertions, 16 deletions
diff --git a/include/events.hpp b/include/events.hpp index 4d1415c..7f70c04 100644 --- a/include/events.hpp +++ b/include/events.hpp @@ -9,6 +9,8 @@ #include <string> +class World; + struct MouseScrollEvent { MouseScrollEvent(int sd = 0) : scrollDistance(sd) {} @@ -38,10 +40,11 @@ struct GameEndEvent { }; struct BGMToggleEvent { - BGMToggleEvent(std::string f) - : file(f) {} + BGMToggleEvent(std::string f = "", World *w = nullptr) + : file(f), world(w) {} std::string file; -} + World *world; +}; #endif // EVENTS_HPP_ diff --git a/include/world.hpp b/include/world.hpp index 3b116ed..17462ca 100644 --- a/include/world.hpp +++ b/include/world.hpp @@ -144,9 +144,11 @@ private: WorldWeather weather; Mix_Music *bgmObj; + std::string bgmObjFile; public: explicit WorldSystem(void); + ~WorldSystem(void); void configure(entityx::EventManager &ev) { ev.subscribe<BGMToggleEvent>(*this); @@ -206,13 +208,6 @@ protected: WorldBGType bgType; /** - * The filename of the world's BGM file. - * - * @see setBGM() - */ - std::string bgm; - - /** * The path to the XML file of the world to the left. * * @see setToLeft() @@ -294,6 +289,12 @@ protected: void drawBackgrounds(); public: + /** + * The filename of the world's BGM file. + * + * @see setBGM() + */ + std::string bgm; CoolArray<Particles> particles; @@ -396,12 +397,6 @@ public: // saves the world's data to an XML file, either the one provided or the current path void save(const std::string& s=""); - // plays/pauses the world's music, according to if a new world is being entered - void bgmPlay(World *prev) const; - - // sets and loads the specified BGM - void setBGM(std::string path); - // sets the world's background theme void setBackground(WorldBGType bgt); |