// Copyright (c) 2024 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #include "JSONLoader.hpp" using namespace Dawn; JSONLoader::JSONLoader( const std::shared_ptr assetManager, const std::string name ) : AssetLoader(assetManager, name), loader(name), state(JSONLoaderState::INITIAL) { } void JSONLoader::updateAsync() { if(this->state != JSONLoaderState::INITIAL) return; this->state = JSONLoaderState::LOADING_JSON; std::string jsonContents = loader.getEntireContentsAsString(); this->data = json::parse(jsonContents); this->state = JSONLoaderState::DONE; this->loaded = true; } void JSONLoader::updateSync() { } JSONLoader::~JSONLoader() { }