fix emplacement de function

This commit is contained in:
2025-01-08 13:33:42 +01:00
parent 2d6a251f3c
commit 488f9a5fb0
6 changed files with 82 additions and 77 deletions

View File

@@ -22,51 +22,6 @@
unsigned int seed;
/**
* \brief Cette fonction permet de joueur des effet sonor.
* \param sfx un int designant le numero du son a jouer.
* du joueur.
* \return Void
*
*/
void playAudio(int sfx)
{
// Charger un fichier son
Mix_Chunk* sfx_win = Mix_LoadWAV("sfx/win.wav");
Mix_Chunk* sfx_lose = Mix_LoadWAV("sfx/lose.wav");
Mix_Chunk* sfx_cant_move = Mix_LoadWAV("sfx/cantmove.wav");
Mix_Chunk* sfx_block_on_target = Mix_LoadWAV("sfx/blockontarget.wav");
Mix_Chunk* sfx_move = Mix_LoadWAV("sfx/move.mp3");
Mix_Chunk* sfx_move_block = Mix_LoadWAV("sfx/moveblock.wav");
switch (sfx)
{
case 0:
Mix_PlayChannel(-1, sfx_win, 0);
return;
case 1:
Mix_PlayChannel(-1, sfx_lose, 0);
return;
case 2:
Mix_PlayChannel(-1, sfx_cant_move, 0);
return;
case 3:
Mix_PlayChannel(-1, sfx_block_on_target, 0);
return;
case 4:
Mix_PlayChannel(-1, sfx_move, 0);
return;
case 5:
Mix_PlayChannel(-1, sfx_move_block, 0);
return;
}
Mix_FreeChunk(sfx_win);
Mix_FreeChunk(sfx_lose);
Mix_FreeChunk(sfx_cant_move);
Mix_FreeChunk(sfx_block_on_target);
Mix_FreeChunk(sfx_move);
Mix_FreeChunk(sfx_move_block);
}
int main ()
{