summaryrefslogtreecommitdiff
path: root/level.h
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2022-01-23 17:11:38 -0700
committercflip <cflip@cflip.net>2022-01-23 17:11:38 -0700
commit98e2eb0beed4f57461956a10eeae014bf88a51c6 (patch)
treee180295cf1286f8cc4b7127e275746c0c733bc0b /level.h
parent6085e71a3274cfadc0e52a4f2355af0176310df0 (diff)
Simple tile editor
Diffstat (limited to 'level.h')
-rw-r--r--level.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/level.h b/level.h
new file mode 100644
index 0000000..ae7ffe3
--- /dev/null
+++ b/level.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <cstdint>
+#include <cstring>
+
+class Level {
+public:
+ Level(int width, int height);
+ ~Level() { delete[] m_tiles; }
+
+ uint8_t get(int x, int y);
+ void set(int x, int y, uint8_t tile);
+ bool inBounds(int x, int y) { return x >= 0 && x < m_width && y >= 0 && y < m_height; }
+private:
+ int m_width, m_height;
+ uint8_t* m_tiles;
+};
+
+enum RailDirection {
+ NorthSouth = 1,
+ EastWest = 2,
+ SouthEast = 3,
+ SouthWest = 4,
+ NorthWest = 5,
+ NorthEast = 6,
+};
+
+RailDirection ChooseDirection(Level& level, int x, int y); \ No newline at end of file