diff options
| author | Arslaan Pathan <[email protected]> | 2026-04-22 21:06:58 +1200 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-04-22 21:06:58 +1200 |
| commit | 289ca3be66a5731fdcd8e2901514ddbb113c5076 (patch) | |
| tree | 6ec66f374e042a57bcfaa288d0aa444517488d45 /src/saffron_window.c | |
| parent | 76516edf2c8c6ba36c0abb48871b5e69e9930dd2 (diff) | |
| download | saffron-289ca3be66a5731fdcd8e2901514ddbb113c5076.tar.xz saffron-289ca3be66a5731fdcd8e2901514ddbb113c5076.zip | |
Make the layout work roughly, make boxes have a size, update test code to work with boxes
Diffstat (limited to 'src/saffron_window.c')
| -rw-r--r-- | src/saffron_window.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/saffron_window.c b/src/saffron_window.c index 74742fa..5687f16 100644 --- a/src/saffron_window.c +++ b/src/saffron_window.c @@ -9,10 +9,10 @@ SaffronWindow* saffron_window_new(const char* title, int w, int h) { SaffronWindow* window = malloc(sizeof(SaffronWindow)); - window->root = (SaffronWidget*)saffron_box_new(SAFFRON_ORIENTATION_VERTICAL, SAFFRON_HALIGN_CENTER, SAFFRON_VALIGN_CENTER, 10, 10, 0); + window->root = (SaffronWidget*)saffron_box_new(SAFFRON_ORIENTATION_VERTICAL, SAFFRON_HALIGN_CENTER, SAFFRON_VALIGN_CENTER, 10, 10, 0, w, h); window->title = title; - window->w = window->root->w = w; - window->h = window->root->h = h; + window->w = w; + window->h = h; Uint32 flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY; window->sdl_window = SDL_CreateWindow(title, w, h, flags); @@ -61,9 +61,13 @@ void saffron_window_main(SaffronWindow *window) { if (!window) return; bool running = true; - printf("[Saffron] window running!\n"); + printf("[Saffron] window starting!\n"); SDL_Event event; + printf("[Saffron] calculating layout on window->root\n"); + saffron_box_layout((SaffronBox*)window->root); + + printf("[Saffron] starting window mainloop\n"); while (running) { while (SDL_PollEvent(&event)) { if (event.type == SDL_EVENT_QUIT) { |
