Merge branch 'master' of gitlab.iut-clermont.uca.fr:maribemont/projet-tut

merge-requests/1/merge
thmaillarb 4 years ago
commit 232256adbe

@ -32,11 +32,11 @@ typedef struct
* \pre At least text or texture must be defined, or an error will be printed in STDERR. * \pre At least text or texture must be defined, or an error will be printed in STDERR.
* \return a button created with the specs passed as params, or NULL if there was an error. * \return a button created with the specs passed as params, or NULL if there was an error.
*/ */
P_Button createButton(const SDL_Texture* texture, const int coordx, const int coordy, const int sizex, const int sizey, void (*onClick)(void)); P_Button createButton(SDL_Texture* texture, const int coordx, const int coordy, const int sizex, const int sizey, void (*onClick)(void));
// texture: design du bouton, si rien n'est passer, le bouton sera générer dans la fonction. // texture: design du bouton, si rien n'est passer, le bouton sera générer dans la fonction.
void changeButtonTexture(P_Button* button, const SDL_Texture* texture); void changeButtonTexture(P_Button* button, const SDL_Texture* texture);
SDL_bool drawButtonOnRenderer(SDL_Renderer* renderer, P_Button* button); SDL_bool drawButtonOnRenderer(SDL_Renderer* renderer, const P_Button* button);
// function isHover(int x,int y) : bool, dit si le bouton est survolé en donnant les coordonnées x,y // function isHover(int x,int y) : bool, dit si le bouton est survolé en donnant les coordonnées x,y
#endif #endif

@ -15,7 +15,7 @@
* *
* Finality : Create a brand new button with specs * Finality : Create a brand new button with specs
*/ */
P_Button createButton(const SDL_Texture* texture, const int coordx, P_Button createButton(SDL_Texture* texture, const int coordx,
const int coordy, const int sizex, const int sizey, const int coordy, const int sizex, const int sizey,
void (*onClick)(void)) void (*onClick)(void))
{ {
@ -24,6 +24,12 @@ P_Button createButton(const SDL_Texture* texture, const int coordx,
assert(texture != NULL && "WARNING: Button created without texture"); assert(texture != NULL && "WARNING: Button created without texture");
b.texture = texture;
return b; return b;
} }
//SDL_bool drawButtonOnRenderer(SDL_Renderer* renderer, P_Button* button) {}
SDL_bool drawButtonOnRenderer(SDL_Renderer* renderer,const P_Button* button)
{
SDL_RenderCopy(renderer,button->texture,NULL,&(button->rect));
}

Loading…
Cancel
Save