summaryrefslogtreecommitdiff
path: root/level.c
diff options
context:
space:
mode:
Diffstat (limited to 'level.c')
-rw-r--r--level.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/level.c b/level.c
new file mode 100644
index 0000000..2c68335
--- /dev/null
+++ b/level.c
@@ -0,0 +1,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];
+}