diff options
| author | Arslaan Pathan <[email protected]> | 2026-04-09 14:08:23 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-04-09 14:08:23 +1200 |
| commit | 0cebba8c7013201ec685b0ca35212294d3d009f3 (patch) | |
| tree | cadeb245975e79aa5758724eac38c22d901ed2eb /tests | |
| parent | 0f19e5f0175b0e031257ccd22f42e21baaf2f720 (diff) | |
| download | saffron-0cebba8c7013201ec685b0ca35212294d3d009f3.tar.xz saffron-0cebba8c7013201ec685b0ca35212294d3d009f3.zip | |
Click event routing
IT WORKS IT WORKS IT WORKS YESSSSSSSSSSSSSSSSS
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_main.c | 13 |
1 files changed, 10 insertions, 3 deletions
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 <stdio.h> +#include <saffron.h> #include <SDL3/SDL.h> -#include <saffron_api.h> #include <SDL3/SDL_rect.h> #include <SDL3/SDL_render.h> -#include <saffron.h> -/* 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(); |
