From 0f19e5f0175b0e031257ccd22f42e21baaf2f720 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Wed, 8 Apr 2026 18:21:40 +1200 Subject: Implement saffron_window_main and saffron_quit, among a few other missing APIs, and get an actual API test to work. IT WORKS IT WORKS IT WORKS THIS IS SO PEAK IT WORKS OHMYGOD IT WORKS FINALLY IT WORKS IT WORKS IT WOORKSKSKSKSKKS!!!!!! --- src/saffron_window.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/saffron_window.c') diff --git a/src/saffron_window.c b/src/saffron_window.c index 10adfce..4bdae76 100644 --- a/src/saffron_window.c +++ b/src/saffron_window.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -22,3 +23,26 @@ void saffron_window_free(SaffronWindow* window) { saffron_widget_free(window->root); free(window); } + +void saffron_window_main(SaffronWindow *window) { + if (!window) return; + + bool running = true; + SDL_Event event; + + while (running) { + while (SDL_PollEvent(&event)) { + if (event.type == SDL_EVENT_QUIT) { + running = false; + } + // TODO: send events to widgets and stuff + } + + SDL_SetRenderDrawColor(window->renderer, 0, 0, 0, 255); + SDL_RenderClear(window->renderer); + saffron_widget_draw(window->root, window->renderer); + SDL_RenderPresent(window->renderer); + + SDL_Delay(16); // around 60fps or so + } +} -- cgit v1.2.3