From ecbcb3afe875ce6c3b74ef12b138a5cb275fecab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathis=20Rib=C3=A9mont?= Date: Mon, 31 Jan 2022 09:36:53 +0100 Subject: [PATCH] freeTexture --- Pontu/include/engine/Button.h | 16 +++------------- Pontu/src/engine/Button.c | 5 +++++ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Pontu/include/engine/Button.h b/Pontu/include/engine/Button.h index 55ec0f3..1e7be9c 100644 --- a/Pontu/include/engine/Button.h +++ b/Pontu/include/engine/Button.h @@ -61,19 +61,9 @@ bool drawButtonOnRenderer(SDL_Renderer* renderer, P_Button* button); bool isHover(P_Button* button, int x,int y);// dit si le bouton est survolé en donnant les coordonnées x,y /** - * \brief Change the texture of the button - * \param[in] button the button target - * \param[in] texture the texture you want to apply to the button - * \return false if the texture is NULL - */ -bool changeButtonTexture(P_Button* button, SDL_Texture* texture); - -/** - * \brief Change the texture to use when the button is hovered - * \param[in] button the button target - * \param[in] texture the texture you want to apply to the button - * \return false if the texture is NULL + * \brief Free the texture of a button. + * \param[in] button the button you want to destroy the texture */ -bool changeButtonHoverTexture(P_Button* button, SDL_Texture* texture); +void freeButton(P_Button * button); #endif diff --git a/Pontu/src/engine/Button.c b/Pontu/src/engine/Button.c index 25dc168..2b0f9b2 100644 --- a/Pontu/src/engine/Button.c +++ b/Pontu/src/engine/Button.c @@ -55,3 +55,8 @@ bool changeButtonHoverTexture(P_Button* button, SDL_Texture* texture) button->hoverTexture = texture; return true; } + +void freeButton(P_Button * button){ + SDL_DestroyTexture(button->texture); + SDL_DestroyTexture(button->textureHover); +}