Merge branch 'master' into feature/rla-19_Zoom

This commit is contained in:
m
2023-07-23 14:34:34 -04:00
6 changed files with 87 additions and 7 deletions

View File

@@ -11,6 +11,6 @@ std::string LuaContextManager::get_key(std::string args) {
// TODO: Switch the arg to a struct and use that to init libraries
std::shared_ptr<sol::state> LuaContextManager::load_resource(std::string args) {
auto lua = std::make_shared<sol::state>();
lua->open_libraries(sol::lib::base, sol::lib::package, sol::lib::math, sol::lib::os);
lua->open_libraries(sol::lib::base, sol::lib::package, sol::lib::math, sol::lib::table);
return lua;
}

View File

@@ -45,3 +45,7 @@ int TileMap::get_width() {
int TileMap::get_height() {
return grid.get_height();
}
TileMap TileMap::clone() {
return {this->get_width(), this->get_height(), this->wall_tile, this->floor_tile};
}

View File

@@ -21,6 +21,7 @@ public:
bool is_wall(int x, int y);
int get_width();
int get_height();
TileMap clone();
TileMap(int width, int height, char wall_tile, char floor_tile) {
this->grid = Grid2D<char>(width, height);

View File

@@ -109,6 +109,9 @@ void Visualizer::initialize_context() {
tilemap_lua["draw_wall"] = &TileMap::draw_wall;
tilemap_lua["fill"] = &TileMap::fill;
tilemap_lua["is_wall"] = &TileMap::is_wall;
tilemap_lua["clone"] = &TileMap::clone;
tilemap_lua["get_width"] = &TileMap::get_width;
tilemap_lua["get_height"] = &TileMap::get_height;
auto algo_manager_lua = lua->new_usertype<AlgorithmManager>("AlgorithmManager", sol::no_constructor);
algo_manager_lua["register_algorithm"] = &AlgorithmManager::register_algorithm;