summaryrefslogtreecommitdiff
path: root/main.c
blob: 760250479f80731e038282964b47556b7480952a (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "TZR.h"
#include "font.h"

static int init(void);
static void deinit(void);

int main(int argc, char **argv)
{
	(void)argc, (void)argv;

	if (init()) {
		printf("init failed\n");
		deinit();
		return 1;
	}
	if (atexit(deinit)) {
		printf("atexit failed\n");
		deinit();
		return 1;
	}

	while (!TZR_ShouldQuit()) {
		TZR_CycleEvents();

		TZR_DrawBegin();
		TZR_DrawSetColor(0, 0, 0, 1);
		TZR_DrawClear();
		TZR_DrawEnd();
	}

	return 0;
}

static int init(void)
{
	if (TZR_Init(.target_fps=30, .pixel_perfect=false, .title="7DRL 2023"))
		return 1;
	if (font_init("res/font.png"))
		return 1;
	return 0;
}

static void deinit(void)
{
	TZR_Quit();
}