summaryrefslogtreecommitdiff
path: root/src/main.c
blob: 7cb99e3f2a2917791992853beaad12dbf7246cfa (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
#include "conf.h"
#include "input.h"
#include "level.h"
#include "lzy.h"
#include "player.h"

static void deinit(void);

int main(int argc, char **argv)
{
	if (LZY_Init(argc, (const char **)argv, "wehfou official goty", 30,
	             "res/tset.png", "res/font.png")) {
		LZY_Log(LZY_GetError());
		deinit();
		return 1;
	}

	level_load(0);
	player_init(0, 0);

	while (!LZY_ShouldQuit()) {
		LZY_CycleEvents();
		input_update();
		player_update();

		LZY_DrawBegin();
		LZY_DrawTileEx(TSET_LINE, 0, 0, 13, 7);
		LZY_DrawTileEx(TSET_LINE, DISPLAY_WIDTH / 2, 0, 13, 7);
		LZY_DrawTileEx(TSET_LINE, 0, DISPLAY_HEIGHT / 2, 13, 7);
		LZY_DrawTileEx(TSET_LINE, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2,
		               13, 7);
		player_draw();
		LZY_DrawEnd();
	}

	deinit();
	return 0;
}

static void deinit(void)
{
	level_deinit();
	LZY_Quit();
}