aboutsummaryrefslogtreecommitdiff
path: root/src/gui/privinc
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-06-24 16:55:18 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-06-26 20:00:27 +0200
commitaea50395c5dbc5c49ad93384b0182d45d45c6441 (patch)
tree6a15906b840244bbd0a4a4745ed8e61d0a87c0e8 /src/gui/privinc
parentaa047f3b95ba4d9074ecadf5227d454cd1e7e7fa (diff)
downloadjancity-aea50395c5dbc5c49ad93384b0182d45d45c6441.tar.gz
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.
Diffstat (limited to 'src/gui/privinc')
-rw-r--r--src/gui/privinc/gui_private.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gui/privinc/gui_private.h b/src/gui/privinc/gui_private.h
new file mode 100644
index 0000000..af18dcd
--- /dev/null
+++ b/src/gui/privinc/gui_private.h
@@ -0,0 +1,17 @@
+#ifndef GUI_PRIVATE_H
+#define GUI_PRIVATE_H
+
+#include <gui.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+void gui_coords(const struct gui_common *g, short *x, short *y);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GUI_PRIVATE_H */