diff options
author | Steph Enders <smenders@gmail.com> | 2022-06-15 23:36:43 -0400 |
---|---|---|
committer | Steph Enders <smenders@gmail.com> | 2022-06-15 23:36:43 -0400 |
commit | eaaf57114cfb74c29f1b0c4e9786bed6d225225c (patch) | |
tree | 8f4946942a9f93f2bba8b1c4c39045e8ee02811d /src/Level.h |
Initial setup commit
This setups up the project for messing around with C++ and Lua bindings.
So far this project just prints the defined dng map and lets you move
the character around.
What this fails to do is actually provide any reason to use Lua at the
moment. So I need to figure out some way of enabling logic on the
processing side of things.
Diffstat (limited to 'src/Level.h')
-rw-r--r-- | src/Level.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/Level.h b/src/Level.h new file mode 100644 index 0000000..1607f0c --- /dev/null +++ b/src/Level.h @@ -0,0 +1,45 @@ +#ifndef DNG_LEVEL_H +#define DNG_LEVEL_H + +static const char PLAYER_TKN = 'p'; +static const char WALL_TKN = 'w'; +static const char EMPTY_TKN = '0'; +static const char TREASURE_TKN = 't'; +static const char ENEMY_TKN = 'e'; +static const char BLANK_SPACE = '\0'; +static const char WALL_SPACE = '#'; + +#include <memory> +#include <vector> + +struct Pos +{ + int id; + int x; + int y; +} typedef Coord; + +class Level +{ + +public: + void loadLevelFromFile(const char* filePath); + + bool isEmpty(int x, int y); + + bool canStep(int dx, int dy); + + void print(); + + int nextId(); + + std::vector<std::vector<char>> map; + Pos player; + std::vector<Pos> enemyPositions; + std::vector<Pos> treasurePositions; + +private: + int idCounter = 1; // defaults at 1 (player always 0) +}; + +#endif // DNG_LEVEL_H |