Switched Button's documentation to Doxygen

availableIslands
thmaillarb 4 years ago
parent e0d29cd6b4
commit b224ad1d5f

@ -1,15 +1,38 @@
/**
* \file Button.h
* \brief Basic button
* \author Allan Point
* \date 29/11/2021
*/
#ifndef BUTTON_INCLUDED
#define BUTTON_INCLUDED
#include <SDL2/SDL_ttf.h>
#include <SDL2/sdl.h>
/**
* \struct P_Button
* \brief Represents a button
*/
typedef struct
{
SDL_Texture* texture; // sprite ou texture de fond
SDL_Rect rect; // définie les coordonnées et la taile, pour la hitbox et l'affichage
void (*onClick)(void);
SDL_Texture* texture; ///> background sprite or texture
SDL_Rect rect; ///> defines coordinates and size for hitbox and display
void (*onClick)(void); ///> action done on click
} P_Button;
/**
* \brief Creates a brand new button with specs
* \param[in] texture background image for the button (can be NULL)
* \param[in] coordx placement in width
* \param[in] coordy placement in height
* \param[in] sizex button's width
* \param[in] sizey button's height
* \param[in] onClick action to do when the button is clicked
* \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.
*/
P_Button createButton(SDL_Texture* texture, int coordx, int coordy, int sizex, int sizey, void (*onClick)(void));
// texture: design du bouton, si rien n'est passer, le bouton sera générer dans la fonction.

@ -2,20 +2,6 @@
#include <stdio.h>
#include <assert.h>
/*
* 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 text and texture
*are not define, the function will return NULL and an error is printed in STDERR.
*
* Params : texture => background image for the button (can be NULL)
* coordx => placement in width
* coordy => placement in height
* sizex => button's width
* sizey => button's height
* onClick => Acction to do when the button is clicked
*
* Finality : Create a brand new button with specs
*/
P_Button createButton(SDL_Texture* texture, int coordx, int coordy, int sizex, int sizey, void (*onClick)(void))
{
// Declarations

Loading…
Cancel
Save