From e9f1f49416061efee56bff7440a04ad5c32ded1a Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 16 Feb 2026 22:41:42 -0600 Subject: [PATCH] add JObject --- .../Archimedes-Modules/Sandbox/JObject.h | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/modules/Archimedes-Modules/Sandbox/JObject.h diff --git a/src/modules/Archimedes-Modules/Sandbox/JObject.h b/src/modules/Archimedes-Modules/Sandbox/JObject.h new file mode 100644 index 0000000..347a760 --- /dev/null +++ b/src/modules/Archimedes-Modules/Sandbox/JObject.h @@ -0,0 +1,54 @@ +#include "pch.hpp" + +#include "Object.h" + +namespace Archimedes { + + using json = nlohmann::json; + + class JObject { + + public: + JObject(std::string path) { + + std::ifstream file(path); + if (!file.is_open()) goodJSON = false; + document = json::parse(file); + file.close(); + templates = document["Templates"]; + objects = document["Objects"]; + setup = document["Set Up"]; + cameras = document["Cameras"]; + lights = document["Lights"]; + actions = document["Actions"]; + } + + bool isValid() const { return goodJSON; } + + std::vector buildObjects() { + + std::vector v; + + + for (json::const_iterator it = templates.cbegin(); it != templates.cend(); it++) + { + json element = *it; + std::string name = element["name"]; + std::string type = element["type"]; + if (type == "CIRCLE") {} + if (type == "SQUARE") {} + if (type == "RECTANGLE") {} + if (type == "POLYGON") {} + if (type == "TEXT") {} + } + + return v; + } + + private: + + bool goodJSON = true; + + json document, templates, objects, setup, cameras, lights, actions; + }; +}