diff --git a/Pontu/include/engine/ButtonActions.h b/Pontu/include/engine/ButtonActions.h index c078e40..4943b36 100644 --- a/Pontu/include/engine/ButtonActions.h +++ b/Pontu/include/engine/ButtonActions.h @@ -20,4 +20,10 @@ void action_setStateToMainMenu(P_Button* caller); */ void action_muteSound(P_Button* caller); +/** + * @brief Button handle which show Settings + * @param caller The button clicked + */ +void action_showSettings(P_Button* caller); + #endif //BUTTON_ACTION_INCLUDED \ No newline at end of file diff --git a/Pontu/rsrc/img/Mute.png b/Pontu/rsrc/img/Mute.png new file mode 100644 index 0000000..4c408b4 Binary files /dev/null and b/Pontu/rsrc/img/Mute.png differ diff --git a/Pontu/rsrc/img/MuteResized.png b/Pontu/rsrc/img/MuteResized.png new file mode 100644 index 0000000..f0841c6 Binary files /dev/null and b/Pontu/rsrc/img/MuteResized.png differ diff --git a/Pontu/rsrc/img/NewSound.png b/Pontu/rsrc/img/NewSound.png new file mode 100644 index 0000000..ab2ed5e Binary files /dev/null and b/Pontu/rsrc/img/NewSound.png differ diff --git a/Pontu/rsrc/img/NewSoundResized.png b/Pontu/rsrc/img/NewSoundResized.png new file mode 100644 index 0000000..5714c88 Binary files /dev/null and b/Pontu/rsrc/img/NewSoundResized.png differ diff --git a/Pontu/rsrc/img/sound_and_mute.jpg b/Pontu/rsrc/img/sound_and_mute.jpg new file mode 100644 index 0000000..6fc15db Binary files /dev/null and b/Pontu/rsrc/img/sound_and_mute.jpg differ diff --git a/Pontu/src/engine/ButtonActions.c b/Pontu/src/engine/ButtonActions.c index d4643bb..a578c1b 100644 --- a/Pontu/src/engine/ButtonActions.c +++ b/Pontu/src/engine/ButtonActions.c @@ -19,5 +19,10 @@ void action_setStateToMainMenu(P_Button* caller) void action_muteSound(P_Button* caller) { //Mute sound -> Master Volume = 0 - changeMasterVol((AudioHandler*)caller->arg,0); -} \ No newline at end of file + AudioHandler audioHandler = *((AudioHandler*)caller->arg); + changeMasterVol(&audioHandler,0); + + //Change Icon -> Mute icon + //caller->texture = createTextureFromPath(renderer,"rsrc/img/MuteResized.png"); +} + diff --git a/Pontu/src/view/GameInterface.c b/Pontu/src/view/GameInterface.c index 014d581..992bb3a 100644 --- a/Pontu/src/view/GameInterface.c +++ b/Pontu/src/view/GameInterface.c @@ -14,6 +14,7 @@ struct array_P_Button createGameInterfaceButtons(SDL_Renderer* renderer, FontHan SDL_Color menuBackgroundColor = {0,255,0,255}; //SDL_Color menuBackgroundColor = {0,0,255,255}; + //struct argsBouton int sizex=20,sizey=20; @@ -21,11 +22,10 @@ struct array_P_Button createGameInterfaceButtons(SDL_Renderer* renderer, FontHan SDL_Texture *menuButtonHoverTexture = createGenericButtonTexture("MenuHover", fontHandler->fonts[FONT_retro], 15, menuBorderColor,menuBackgroundColor,13,5,&sizex,&sizey,renderer); SDL_Texture *settingsButtonTexture = createTextureFromPath(renderer,"rsrc/img/SettingsResized.png"); - //SDL_Texture *settingsButtonTexture = createGenericButtonTexture("Settings", fontHandler->fonts[FONT_retro], 15, menuBorderColor,menuBackgroundColor,13,5,&sizex,&sizey,renderer); SDL_Texture *settingsButtonHoverTexture = createGenericButtonTexture("SettingsHover", fontHandler->fonts[FONT_retro], 15, menuBorderColor,menuBackgroundColor,13,5,&sizex,&sizey,renderer); - SDL_Texture *muteButtonTexture = createTextureFromPath(renderer,"rsrc/img/SoundResized.png"); - //SDL_Texture *muteButtonTexture = createGenericButtonTexture("Mute", fontHandler->fonts[FONT_retro], 15, menuBorderColor,menuBackgroundColor,13,5,&sizex,&sizey,renderer); + //SDL_Texture *muteButtonTexture = createTextureFromPath(renderer,"rsrc/img/SoundResized.png"); + SDL_Texture *muteButtonTexture = createTextureFromPath(renderer,"rsrc/img/NewSoundResized.png"); SDL_Texture *muteButtonHoverTexture = createGenericButtonTexture("MuteHover", fontHandler->fonts[FONT_retro], 15, menuBorderColor,menuBackgroundColor,13,5,&sizex,&sizey,renderer); struct array_P_Button buttons = array_P_Button_Create(); @@ -33,13 +33,13 @@ struct array_P_Button createGameInterfaceButtons(SDL_Renderer* renderer, FontHan // Menu array_P_Button_AddElement(&buttons, createButton(menuButtonTexture, menuButtonHoverTexture,20,20,100,50,&action_setStateToMainMenu)); //top left corner (rectangle) array_P_Button_Last(&buttons)->arg = (void*)generalState; - + // Settings array_P_Button_AddElement(&buttons, createButton(settingsButtonTexture, settingsButtonHoverTexture, 750,10,50,50,&action_print)); //top right corner (square or circle) - + // Mute/Unmute array_P_Button_AddElement(&buttons, createButton(muteButtonTexture, muteButtonHoverTexture, 825,10,50,50,&action_muteSound)); //top right cornre (square or circle) - //array_P_Button_Last(&buttons)->arg = (void*)audioHandler; + array_P_Button_Last(&buttons)->arg = (void*)&audioHandler; return buttons; }