|
|
@ -4,7 +4,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Return : a button within written <text>, placed in (<coordx>; <coordy>), sized <sizex>x<sizey>. The button returned will do <onClick> when it will be clicked
|
|
|
|
* Return : a button within written <text>, placed in (<coordx>; <coordy>), sized <sizex>x<sizey>. The button returned will do <onClick> when it will be clicked
|
|
|
|
* If texture is not define, the function will return NULL and an error is printed in STDERR.
|
|
|
|
* If texture is not define, the function will return NULL and an error is printed in STDERR.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Params : texture => image for the button
|
|
|
|
* Params : texture => image for the button
|
|
|
|
* coordx => placement in width
|
|
|
|
* coordx => placement in width
|
|
|
@ -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));
|
|
|
|
|
|
|
|
}
|
|
|
|