New world and player files format

This commit is contained in:
MihailRis
2023-12-03 22:03:59 +03:00
parent b62b7bf2bb
commit 2f9244c17c
6 changed files with 168 additions and 79 deletions
+2 -8
View File
@@ -12,6 +12,7 @@
#include <glm/glm.hpp>
// don't ask
using glm::vec3;
using std::cout;
using std::cerr;
@@ -24,14 +25,7 @@ ContentLoader::ContentLoader(path folder) : folder(folder) {}
// TODO: add basic validation and logging
Block* ContentLoader::loadBlock(string name, path file) {
string source = files::read_string(file);
unique_ptr<json::JObject> root = nullptr;
try {
root.reset(json::parse(file.string(), source));
} catch (const parsing_error& error) {
cerr << error.errorLog() << endl;
throw std::runtime_error("could not load block def");
}
unique_ptr<json::JObject> root(files::read_json(file));
unique_ptr<Block> def(new Block(name));
// block texturing