mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Play sounds/main_menu.ogg in menu
This commit is contained in:
parent
174285f298
commit
4fb4efd8ed
7 changed files with 117 additions and 47 deletions
|
@ -30,6 +30,8 @@ extern "C" {
|
|||
#include "main.h"
|
||||
#include "settings.h"
|
||||
#include "guiMainMenu.h"
|
||||
#include "sound.h"
|
||||
#include "sound_openal.h"
|
||||
|
||||
#include "guiEngine.h"
|
||||
|
||||
|
@ -84,6 +86,7 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
|
|||
m_menumanager(menumgr),
|
||||
m_smgr(smgr),
|
||||
m_data(data),
|
||||
m_sound_manager(NULL),
|
||||
m_formspecgui(0),
|
||||
m_buttonhandler(0),
|
||||
m_menu(0),
|
||||
|
@ -122,6 +125,14 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
|
|||
m_data->errormessage = "";
|
||||
}
|
||||
|
||||
//create soundmanager
|
||||
MenuMusicFetcher soundfetcher;
|
||||
#if USE_SOUND
|
||||
m_sound_manager = createOpenALSoundManager(&soundfetcher);
|
||||
#endif
|
||||
if(!m_sound_manager)
|
||||
m_sound_manager = &dummySoundManager;
|
||||
|
||||
//create topleft header
|
||||
core::rect<s32> rect(0, 0, 500, 40);
|
||||
rect += v2s32(4, 0);
|
||||
|
@ -299,7 +310,12 @@ GUIEngine::~GUIEngine()
|
|||
{
|
||||
video::IVideoDriver* driver = m_device->getVideoDriver();
|
||||
assert(driver != 0);
|
||||
|
||||
|
||||
if(m_sound_manager != &dummySoundManager){
|
||||
delete m_sound_manager;
|
||||
m_sound_manager = NULL;
|
||||
}
|
||||
|
||||
//TODO: clean up m_menu here
|
||||
|
||||
lua_close(m_engineluastack);
|
||||
|
@ -571,3 +587,16 @@ void GUIEngine::setTopleftText(std::string append) {
|
|||
|
||||
m_irr_toplefttext->setText(narrow_to_wide(toset).c_str());
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
s32 GUIEngine::playSound(SimpleSoundSpec spec, bool looped)
|
||||
{
|
||||
s32 handle = m_sound_manager->playSound(spec, looped);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void GUIEngine::stopSound(s32 handle)
|
||||
{
|
||||
m_sound_manager->stopSound(handle);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue