aboutsummaryrefslogtreecommitdiff
path: root/src/saffron_window.c
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-04-08 13:41:35 +1200
committerArslaan Pathan <[email protected]>2026-04-08 13:41:35 +1200
commitc9660a840256308d4dde40613a1af3296d3fdead (patch)
tree13e3049ea6bc6d2606bffeced7dc1ead990a1169 /src/saffron_window.c
parent04ff8c0a6acc2cc9204492690b7f99f892ed439a (diff)
downloadsaffron-c9660a840256308d4dde40613a1af3296d3fdead.tar.xz
saffron-c9660a840256308d4dde40613a1af3296d3fdead.zip
what (i cannot put the commit message into words)
I added a lot of stuff, it dont really work fully yet but its very good stuff
Diffstat (limited to 'src/saffron_window.c')
-rw-r--r--src/saffron_window.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/saffron_window.c b/src/saffron_window.c
new file mode 100644
index 0000000..10adfce
--- /dev/null
+++ b/src/saffron_window.c
@@ -0,0 +1,24 @@
+#include <stdlib.h>
+#include <SDL3/SDL.h>
+#include <SDL3_ttf/SDL_ttf.h>
+#include <saffron_api.h>
+#include <saffron_widget.h>
+#include <saffron_window.h>
+
+SaffronWindow* saffron_window_new(const char* title, int w, int h) {
+ SaffronWindow* window = malloc(sizeof(SaffronWindow));
+ window->root = saffron_widget_new(); // frick, need to implement this.
+ window->title = title;
+ window->w = w;
+ window->h = h;
+ window->sdl_window = SDL_CreateWindow(title, w, h, SDL_WINDOW_RESIZABLE);
+ window->renderer = SDL_CreateRenderer(window->sdl_window, NULL);
+ return window;
+}
+
+void saffron_window_free(SaffronWindow* window) {
+ SDL_DestroyRenderer(window->renderer);
+ SDL_DestroyWindow(window->sdl_window);
+ saffron_widget_free(window->root);
+ free(window);
+}