summaryrefslogtreecommitdiff
path: root/main.c
blob: 6381f68a4f87530381be34a952de91751604b39d (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
47
48
49
50
51
52
53
#include "TZR.h"
#include "font.h"
#include "dialog.h"
#include "choice.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;
	}

	dialog_set("yo BnormieW\njsuis Bweird_gusW\ntu me replacesG?");
	choice_begin("on");

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

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

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

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