summaryrefslogtreecommitdiff
path: root/main.cpp
blob: 52db89d855f3225aaa250a2e4cccd4578f75cdf8 (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
#include "cfg.hpp"
#include "lzr.h"
#include "input.h"
#include "Table.hpp"
#include "Cursor.hpp"
#include "Menu.hpp"
#include <string.h>
#include <SDL2/SDL_main.h>

int main(int argc, char **argv)
{
	(void)argc, (void)argv;
	if (LZR_Init(cfg))
	{
		LZR_Quit();
		return 1;
	}
	LZR_ToggleFullscreen();
	char snd_path[] = "res/sample_x.wav";
	char *snd_x = strchr(snd_path, 'x');
	for (int i = 0; i < 3; i++) {
		*snd_x = '0' + i;
		if (LZR_SoundLoad(snd_path, (i == 1) ? 0.8f : 1.0f) < 0) {
			LZR_Quit();
			return 1;
		}
	}
	if (LZR_SoundLoad("res/suk.wav", 0.5f) < 0) {
		LZR_Quit();
		return 1;
	}
	Cursor cursor;
	Table table;
	Menu menu;
	while (!LZR_ShouldQuit()) {
		LZR_CycleEvents();
		input_update();
		cursor.update();
		table.update(cursor);
		menu.update(cursor);
		table.set_layer(menu.get_selection());
		LZR_DrawBegin();
		LZR_DrawSetColor(0, 0, 0, 1);
		LZR_DrawClear();
		table.draw(cursor);
		menu.draw();
		cursor.draw();
		LZR_DrawEnd();
	}
	LZR_Quit();
	return 0;
}