From f69dc6f359015e992d181c60cd815cefd6c62aad Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sun, 10 Jul 2022 00:21:09 +0200 Subject: Allow children of gui_container be resized anytime So far, their position inside the container was determined when initializing the interface. However, if a child were resized afterwards, the container would not adjust its elements accordingly. Moreover, the implementation for gui_container relied on hacking the children's X/Y coordinates, which could only be done once. Now, two additional members have been added to gui_common so that specific X/Y offset can be determined by the parent, additionally to the traditional rules followed by gui_coords. Despite the extra memory footprint, it now allows containers to set specific X/Y offsets for their children on every game cycle. --- src/gui/inc/gui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/inc') diff --git a/src/gui/inc/gui.h b/src/gui/inc/gui.h index 18ed37b..84a6c66 100644 --- a/src/gui/inc/gui.h +++ b/src/gui/inc/gui.h @@ -21,7 +21,7 @@ struct gui_common void (*get_dim)(const struct gui_common *, short *w, short *h); } *cb; - short x, y; + short x, y, xoff, yoff; bool hcentered, vcentered; struct gui_common *parent, *child, *sibling; }; -- cgit v1.2.3