diff --git a/Pontu/include/engine/Button.h b/Pontu/include/engine/Button.h index 1152304..d2efb2b 100644 --- a/Pontu/include/engine/Button.h +++ b/Pontu/include/engine/Button.h @@ -70,11 +70,19 @@ 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 Test if a point is on a button + * \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 + */ +bool changeButtonHoverTexture(P_Button* button, SDL_Texture* texture); + #endif diff --git a/Pontu/src/engine/Button.c b/Pontu/src/engine/Button.c index 57419cc..36804a8 100644 --- a/Pontu/src/engine/Button.c +++ b/Pontu/src/engine/Button.c @@ -42,3 +42,12 @@ bool changeButtonTexture(P_Button* button, SDL_Texture* texture) } button->texture = texture; } + +bool changeButtonHoverTexture(P_Button* button, SDL_Texture* texture) +{ + if(texture == NULL){ + fprintf(stderr,"Warning: button texture cannot change to NULL\n"); + return false; + } + button->hoverTexture = texture; +}