From cce512b7252ff7fd3f1329f224407fb772c9b4aa Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Tue, 21 Apr 2026 18:11:23 +1200 Subject: A bunch of more layout work --- include/saffron_widget.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'include/saffron_widget.h') diff --git a/include/saffron_widget.h b/include/saffron_widget.h index 6d7b6bd..4461555 100644 --- a/include/saffron_widget.h +++ b/include/saffron_widget.h @@ -3,13 +3,22 @@ #include +typedef enum{ + SAFFRON_SIZE_FIXED, + SAFFRON_SIZE_STRETCH, + SAFFRON_SIZE_SCALE // scale but keep aspect ratio. this must be set on BOTH size modes (width AND height) to work +} SaffronSizeMode; + typedef struct SaffronWidget { int x, y, w, h; void (*draw)(struct SaffronWidget *self, SDL_Renderer *renderer); void (*on_click)(struct SaffronWidget *self); - struct SaffronWidget *parent; - struct SaffronWidget **children; + struct SaffronWidget* parent; + struct SaffronWidget** children; int child_count; + SaffronSizeMode width_mode; + SaffronSizeMode height_mode; + bool pixel_perfect; // Do we scale dynamically (SaffronSizeMode, etc) or use raw x, y, w, h values? If this is true, the SaffronSizeModes from earlier will be ignored } SaffronWidget; #endif -- cgit v1.2.3