diff options
Diffstat (limited to 'tests/test_main.c')
| -rw-r--r-- | tests/test_main.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/test_main.c b/tests/test_main.c index 39b41f2..cb92189 100644 --- a/tests/test_main.c +++ b/tests/test_main.c @@ -1,5 +1,6 @@ #include "saffron_api.h" #include "saffron_layout.h" +#include "saffron_theme.h" #include <stdio.h> #include <saffron.h> #include <SDL3/SDL.h> @@ -11,11 +12,16 @@ * THEY will make draw functions for you * THIS IS A BAD IDEA */ void my_test_draw(SaffronWidget* self, SDL_Renderer* renderer) { - SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); + /* make use of the theme! */ + SaffronTheme* theme = self->theme; + if (!theme) return; // good luck + SaffronColor secondary = theme->secondary; + SaffronColor tertiary = theme->tertiary; + SDL_SetRenderDrawColor(renderer, secondary.r, secondary.g, secondary.b, secondary.a); SDL_FRect rect = {self->x, self->y, self->w, self->h}; SDL_RenderFillRect(renderer, &rect); - SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + SDL_SetRenderDrawColor(renderer, tertiary.r, tertiary.g, tertiary.b, tertiary.a); SDL_RenderRect(renderer, &rect); } @@ -33,6 +39,7 @@ int main(void) { /* replace the root with our own, because we want horizontal */ saffron_widget_free(window->root); window->root = (SaffronWidget*)saffron_box_new(SAFFRON_ORIENTATION_HORIZONTAL, SAFFRON_HALIGN_LEFT, SAFFRON_VALIGN_TOP, 5, 5, 0, window->w, window->h); + window->root->theme = SF_MACRO_DEFAULT_THEME; /* i guess IM THE LUNATIC NOW * DEAL WITH IT */ @@ -52,9 +59,8 @@ int main(void) { test2->h = 72; test2->draw = my_test_draw; - SDL_Color color = {255, 255, 255, 255}; TTF_Font* font = TTF_OpenFont("/usr/share/fonts/fantasque-sans-mono/FantasqueSansMono-Regular.otf", 24); - SaffronText* test3 = saffron_text_new("Mangoes", font, color); + SaffronText* test3 = saffron_text_new("Mangoes", font); /* become lunatic, add custom clickhandler to.. text????????????? */ ((SaffronWidget*)test3)->on_click = my_test_onclick; |
