From 1493986b6b22d83cf6c1641a02202bd7b36258a1 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 12 Oct 2016 08:25:59 -0400 Subject: worldsystem gets music --- include/events.hpp | 9 ++++++--- include/world.hpp | 21 ++++++++------------- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'include') 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 +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(*this); @@ -205,13 +207,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. * @@ -294,6 +289,12 @@ protected: void drawBackgrounds(); public: + /** + * The filename of the world's BGM file. + * + * @see setBGM() + */ + std::string bgm; CoolArray 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); -- cgit v1.2.3