From 0cebba8c7013201ec685b0ca35212294d3d009f3 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Thu, 9 Apr 2026 14:08:23 +1200 Subject: Click event routing IT WORKS IT WORKS IT WORKS YESSSSSSSSSSSSSSSSS --- tests/test_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test_main.c b/tests/test_main.c index c171192..5bef6d5 100644 --- a/tests/test_main.c +++ b/tests/test_main.c @@ -1,10 +1,10 @@ +#include +#include #include -#include #include #include -#include -/* PLEASE don't do this in production +/* PLEASE don't do this in production! * when wrappers are implemented, * THEY will make draw functions for you * THIS IS A BAD IDEA */ @@ -17,6 +17,12 @@ void my_test_draw(SaffronWidget* self, SDL_Renderer* renderer) { SDL_RenderRect(renderer, &rect); } +/* YET AGAIN DONT DO THIS IN PROD PLEASE + * this is very lunatic */ +void my_test_onclick(SaffronWidget* self) { + printf("clicked!\n"); +} + int main(void) { saffron_init(); @@ -30,6 +36,7 @@ int main(void) { test->w = 200; test->h = 150; test->draw = my_test_draw; + test->on_click = my_test_onclick; /* lunatic method 2 */ SaffronWidget* test2 = saffron_widget_new(); -- cgit v1.2.3