Compare commits

...

3 Commits

5 changed files with 13 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -17,7 +17,7 @@ namespace gamestate
fondo = draw::loadSurface("menuprin.gif", true);
cursor = draw::loadSurface("cursor.gif");
if (audio::getMusicState() != audio::music_state::MUSIC_PLAYING) {
if (audio::getMusicState() != audio::music_state::MUSIC_PLAYING || audio::whichMusic() != "mus3.ogg") {
audio::playMusic(audio::loadMusic("mus3.ogg"));
}

View File

@@ -15,6 +15,7 @@ namespace audio
static char *buffer = nullptr;
static Mix_Music *music = nullptr;
static std::string music_filename = "";
// Inicialitza el sistema de só
void init()
@@ -47,6 +48,7 @@ namespace audio
if (music==nullptr) return false;
music_filename = filename;
return true;
}
@@ -99,6 +101,12 @@ namespace audio
}
}
// Obté el nom de l'arxiu de música actual
std::string whichMusic()
{
return music_filename;
}
// Carrega un só des d'un arxiu WAV
const sound *loadSound(const std::string filename)
{

View File

@@ -55,6 +55,10 @@ namespace audio
/// @return estat actual de la música (MUSIC_INVALID, MUSIC_PLAYING, MUSIC_PAUSED o MUSIC_STOPPED)
const music_state getMusicState();
/// @brief Obté el nom de l'arxiu de música actual
/// @return el nom de l'arxiu
std::string whichMusic();
/// @brief Carrega un só des d'un arxiu WAV
/// @param filename nom de l'arxiu
/// @return un punter al só