diff options
author | PilzAdam <pilzadam@minetest.net> | 2013-07-28 23:14:42 +0200 |
---|---|---|
committer | PilzAdam <pilzadam@minetest.net> | 2013-07-28 23:29:03 +0200 |
commit | 4fb4efd8ed54a81ea545e51265f2acdd01654f21 (patch) | |
tree | 4f47e2a94931500675ca11f6b008d4186f4c1b61 /src/guiEngine.h | |
parent | 174285f29878c7171c84848ae9282a9efa546bd6 (diff) | |
download | minetest-4fb4efd8ed54a81ea545e51265f2acdd01654f21.tar.gz minetest-4fb4efd8ed54a81ea545e51265f2acdd01654f21.tar.bz2 minetest-4fb4efd8ed54a81ea545e51265f2acdd01654f21.zip |
Play sounds/main_menu.ogg in menu
Diffstat (limited to 'src/guiEngine.h')
-rw-r--r-- | src/guiEngine.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/guiEngine.h b/src/guiEngine.h index 2445ed847..2f96b0b1c 100644 --- a/src/guiEngine.h +++ b/src/guiEngine.h @@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "clouds.h" #include "guiLuaApi.h" #include "guiFormSpecMenu.h" +#include "sound.h" /******************************************************************************/ /* Typedefs and macros */ @@ -50,6 +51,7 @@ typedef enum { /******************************************************************************/ class GUIEngine; struct MainMenuData; +struct SimpleSoundSpec; /******************************************************************************/ /* declarations */ @@ -80,6 +82,30 @@ private: GUIEngine* m_engine; }; +class MenuMusicFetcher: public OnDemandSoundFetcher +{ + std::set<std::string> m_fetched; +public: + + void fetchSounds(const std::string &name, + std::set<std::string> &dst_paths, + std::set<std::string> &dst_datas) + { + if(m_fetched.count(name)) + return; + m_fetched.insert(name); + std::string base; + base = porting::path_share + DIR_DELIM + "sounds"; + dst_paths.insert(base + DIR_DELIM + name + ".ogg"); + int i; + for(i=0; i<10; i++) + dst_paths.insert(base + DIR_DELIM + name + "."+itos(i)+".ogg"); + base = porting::path_user + DIR_DELIM + "sounds"; + dst_paths.insert(base + DIR_DELIM + name + ".ogg"); + for(i=0; i<10; i++) + dst_paths.insert(base + DIR_DELIM + name + "."+itos(i)+".ogg"); + } +}; /** implementation of main menu based uppon formspecs */ class GUIEngine { @@ -106,6 +132,9 @@ public: /** default destructor */ virtual ~GUIEngine(); + s32 playSound(SimpleSoundSpec spec, bool looped); + void stopSound(s32 handle); + protected: /** * process field data recieved from formspec @@ -143,6 +172,8 @@ private: scene::ISceneManager* m_smgr; /** pointer to data beeing transfered back to main game handling */ MainMenuData* m_data; + /** pointer to soundmanager*/ + ISoundManager* m_sound_manager; /** representation of form source to be used in mainmenu formspec */ FormspecFormSource* m_formspecgui; |