From 7c75118429596dcfd86dbefb32e9ae79585c4da0 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Fri, 24 Jun 2022 16:55:18 +0200 Subject: Revamp gui component `gui` was tighly coupled to game logic, and could not be extended for other purposes. Therefore, a generic GUI implementation, loosely inspired by well-known GUI frameworks such as GTK, is now provided, with the following properties: - Does not depend on dynamic or static memory allocation, only automatic (i.e., stack) memory allocation required. - Portable among existing implementations. - Simple to extend. - Tiny memory footprint. `gui` is now composed by GUI elements that can be chained to form a tree structure. This is useful e.g.: to calculate X/Y coordinates for a given GUI element given its parent(s). This commit also refactors the older implementation, moving game-specific logic into `player` and making use of the new component. --- src/button/inc/button.h | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete 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 deleted file mode 100644 index 062cb07..0000000 --- a/src/button/inc/button.h +++ /dev/null @@ -1,36 +0,0 @@ -#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