Mario Editor: add save/load functionality

This commit is contained in:
2022-07-21 19:26:50 +02:00
parent 92ffac0edf
commit 4143af9962
5 changed files with 204 additions and 149 deletions
+5 -1
View File
@@ -96,6 +96,10 @@ MapObject parseBlock(std::ifstream &map_file) {
modifier_id, modifier_data);
}
void loadEmptyMap( std::vector<mapColumnType> &objects, size_t editor_width) {
objects.resize(editor_width);
}
// editor loader
// TODO catch exception in calling functions
void loadMap(std::shared_ptr<SDLPP::Scene> &scene,
@@ -104,7 +108,7 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene,
bool editor, size_t editor_width) {
if(!FSLib::exists(file)) {
// create empty array large enough for initial editor window
objects.resize(editor_width);
loadEmptyMap(objects, editor_width);
return;
}
auto renderer = scene->getRendererShared();