From cb7af3f4cac90f95926477b4001f9f80037568d5 Mon Sep 17 00:00:00 2001 From: Jun Zhang Date: Sun, 30 Jan 2022 12:30:02 +0800 Subject: refactor: adjust the project infra. (#1) * refactor: adjust the project infra. This patch adds cmake build system to the project, and adjust infrastructure stuff. Signed-off-by: Jun Zhang * fix: remove compiler flags that only exist in GCC. Signed-off-by: Jun Zhang --- src/level.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/level.h (limited to 'src/level.h') diff --git a/src/level.h b/src/level.h new file mode 100644 index 0000000..0ffdac2 --- /dev/null +++ b/src/level.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include + +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, + SouthEast, + SouthWest, + NorthWest, + NorthEast, +}; + +RailDirection ChooseDirection(Level& level, int x, int y); \ No newline at end of file -- cgit v1.2.3