summaryrefslogtreecommitdiff
path: root/level.c
blob: 2c68335051e9d2716732db9dc1c5249ea7ea99a9 (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
#include "level.h"
#include "lzr.h"
#include "cfg.h"

static const char level[LEVEL_HEIGHT * LEVEL_WIDTH] = {
	"000000000000"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"0..........0"
	"000000000000"
};

void level_draw()
{
	LZR_DrawSetColor(1, 1, 1, 1);
	for (int y = 0; y < LEVEL_HEIGHT; y++)
	for (int x = 0; x < LEVEL_WIDTH; x++) {
		const int dx = (x + 3) * CFG_TSIZE;
		const int dy = y * CFG_TSIZE;
		if (level_get(x, y) == '0')
			LZR_DrawRectangle(true, dx, dy, CFG_TSIZE, CFG_TSIZE);
	}
}

int level_get(int x, int y)
{
	return level[x + y * LEVEL_WIDTH];
}