From eaaf57114cfb74c29f1b0c4e9786bed6d225225c Mon Sep 17 00:00:00 2001 From: Steph Enders Date: Wed, 15 Jun 2022 23:36:43 -0400 Subject: 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. --- src/Level.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 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..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 +#include + +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> map; + Pos player; + std::vector enemyPositions; + std::vector treasurePositions; + +private: + int idCounter = 1; // defaults at 1 (player always 0) +}; + +#endif // DNG_LEVEL_H -- cgit v1.2.3-54-g00ecf