diff options
| author | Arslaan Pathan <[email protected]> | 2026-04-26 10:52:34 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-04-26 10:52:34 +1200 |
| commit | 4fbf7e5b7b5325828099456c347183ba92864862 (patch) | |
| tree | fef509e9f5ecc64cc9070b7a5820318908dbc156 /include | |
| parent | a2252b2952e4027b7edb420dccbd8494ae822b0f (diff) | |
| download | saffron-4fbf7e5b7b5325828099456c347183ba92864862.tar.xz saffron-4fbf7e5b7b5325828099456c347183ba92864862.zip | |
[feat] add some stuff??
Diffstat (limited to 'include')
| -rw-r--r-- | include/saffron.h | 3 | ||||
| -rw-r--r-- | include/saffron_api.h | 7 | ||||
| -rw-r--r-- | include/saffron_button.h | 8 | ||||
| -rw-r--r-- | include/saffron_text.h | 15 | ||||
| -rw-r--r-- | include/saffron_widget.h | 1 |
5 files changed, 31 insertions, 3 deletions
diff --git a/include/saffron.h b/include/saffron.h index d5cc59f..53f27fb 100644 --- a/include/saffron.h +++ b/include/saffron.h @@ -1,6 +1,9 @@ #ifndef SAFFRON_H #define SAFFRON_H +#include <SDL3/SDL.h> +#include <SDL3_ttf/SDL_ttf.h> + #include "saffron_api.h" #include "saffron_button.h" #include "saffron_text.h" diff --git a/include/saffron_api.h b/include/saffron_api.h index 64251e0..4ab4731 100644 --- a/include/saffron_api.h +++ b/include/saffron_api.h @@ -4,6 +4,10 @@ #include "saffron_widget.h" /* satisfy the lsp and also if someone includes api without the saffron.h wrapper (you lunatic) then it still works */ #include "saffron_window.h" #include "saffron_layout.h" +#include "saffron_text.h" +#include <SDL3/SDL_render.h> +#include <SDL3_ttf/SDL_ttf.h> +#include <SDL3/SDL_pixels.h> bool saffron_init(void); void saffron_quit(void); @@ -23,4 +27,7 @@ SaffronWidget* saffron_widget_hit_test(SaffronWidget* widget, int x, int y); SaffronBox* saffron_box_new(SaffronOrientation orientation, SaffronHorizontalAlignment halign, SaffronVerticalAlignment valign, int spacing, int padding, int margin, int width, int height); void saffron_box_layout(SaffronBox* box); +SaffronText* saffron_text_new(const char* text, int font_size, SDL_Color color); +void saffron_text_set_text(SaffronText* text, const char* new_text); + #endif diff --git a/include/saffron_button.h b/include/saffron_button.h index 3112edf..ab4ed97 100644 --- a/include/saffron_button.h +++ b/include/saffron_button.h @@ -1,11 +1,13 @@ #ifndef SAFFRON_BUTTON_H #define SAFFRON_BUTTON_H +#include "saffron_layout.h" #include "saffron_widget.h" -typedef struct { - SaffronWidget base; // must be first, or we're f**ked - const char* label; +typedef struct SaffronButton { + SaffronBox base; + void (*callback)(struct SaffronButton* self); + bool enabled; } SaffronButton; #endif diff --git a/include/saffron_text.h b/include/saffron_text.h index e69de29..51bfc47 100644 --- a/include/saffron_text.h +++ b/include/saffron_text.h @@ -0,0 +1,15 @@ +#ifndef SAFFRON_TEXT_H +#define SAFFRON_TEXT_H + +#include "saffron_widget.h" +#include <SDL3/SDL_pixels.h> +#include <SDL3_ttf/SDL_ttf.h> + +typedef struct { + SaffronWidget base; + char* text; + TTF_Font* font; + SDL_Color color; +} SaffronText; + +#endif diff --git a/include/saffron_widget.h b/include/saffron_widget.h index 7fc6bc8..ddf4f78 100644 --- a/include/saffron_widget.h +++ b/include/saffron_widget.h @@ -12,6 +12,7 @@ typedef enum { typedef enum { SAFFRON_WIDGET_UNKNOWN, SAFFRON_WIDGET_BOX, + SAFFRON_WIDGET_TEXT } SaffronWidgetType; typedef struct SaffronWidget { |
