fix emplacement de function
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
#include <SDL2/SDL_mutex.h>
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
#include <SDL2/SDL_rect.h>
|
||||
#include <SDL2/SDL_render.h>
|
||||
#include <SDL2/SDL_surface.h>
|
||||
@@ -311,3 +312,50 @@ void backgroundDisplay(dis *display_user,int bg)
|
||||
SDL_DestroyTexture (texture);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* \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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user