aboutsummaryrefslogtreecommitdiff
path: root/src/saffron.c
blob: 87241013b7626df0519d342bd11524ac27b0d2d7 (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
25
26
27
28
29
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <SDL3/SDL.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <saffron.h> /* meson include directories */

bool saffron_init(void) {
	if (!SDL_Init(SDL_INIT_VIDEO)) {
		printf("[saffron] SDL init failed: %s\n", SDL_GetError());
		return false;
	}
	if (!TTF_Init()) {
		printf("[saffron] TTF init failed: %s\n", SDL_GetError());
		return false;
	}
	return true;
}

void saffron_widget_draw(SaffronWidget* widget, SDL_Renderer *renderer) {
	// do stuff later
}

void saffron_widget_add_child(SaffronWidget *parent, SaffronWidget *child) {
	child->parent = parent;
	parent->children = realloc(parent->children, sizeof(SaffronWidget*) * (parent->child_count + 1));
	parent->children[parent->child_count] = child;
	parent->child_count++;
}