blob: 10adfcea240a624a10f49d60f075c22dcf48c8d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
}
|