From 6bd14230b3ed93e7eeab55d957db685c63a65069 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Sun, 26 Apr 2026 19:55:37 +1200 Subject: Make it better --- tests/test_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/test_main.c b/tests/test_main.c index c3ea050..39b41f2 100644 --- a/tests/test_main.c +++ b/tests/test_main.c @@ -52,20 +52,21 @@ int main(void) { test2->h = 72; test2->draw = my_test_draw; - /* lunatic method 3 */ - SaffronWidget* test3 = saffron_widget_new(); - test3->w = 200; - test3->h = 73; - test3->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); + /* become lunatic, add custom clickhandler to.. text????????????? */ + ((SaffronWidget*)test3)->on_click = my_test_onclick; saffron_widget_add_child(window->root, test); saffron_widget_add_child(window->root, box); saffron_widget_add_child(box, test2); - saffron_widget_add_child(box, test3); + saffron_widget_add_child(box, (SaffronWidget*)test3); saffron_window_main(window); saffron_window_free(window); + TTF_CloseFont(font); saffron_quit(); return 0; } -- cgit v1.2.3