From 6f74cbd20b1fe0ef9f2a55057e9ac066bec0b575 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 11 Jun 2022 23:22:04 +0200 Subject: Implement button component --- src/button/inc/button.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/button/inc/button.h (limited to 'src/button/inc/button.h') diff --git a/src/button/inc/button.h b/src/button/inc/button.h new file mode 100644 index 0000000..062cb07 --- /dev/null +++ b/src/button/inc/button.h @@ -0,0 +1,36 @@ +#ifndef BUTTON_H +#define BUTTON_H + +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +enum +{ + BUTTON_LEFT, + BUTTON_MID, + BUTTON_RIGHT, + + MAX_BUTTON_SPRITES +}; + +struct button +{ + const char *text; + short x, y, w; +}; + +bool button_is_pressed(const struct button *b); +int button_render(const struct button *b); + +extern struct sprite button_sprites[MAX_BUTTON_SPRITES]; + +#ifdef __cplusplus +} +#endif + +#endif /* BUTTON_H */ -- cgit v1.2.3