// Copyright (c) 2023 Dominic Masters // // This software is released under the MIT License. // https://opensource.org/licenses/MIT #include "SceneAssetParser.hpp" using namespace Dawn; std::vector SceneAssetParser::getRequiredAttributes() { return { "type", "name" }; } std::map SceneAssetParser::getOptionalAttributes() { return { { "ref", "" } }; } int32_t SceneAssetParser::onParse( Xml *node, std::map values, struct SceneAsset *out, std::string *error ) { out->fileName = values["name"]; if(values["type"] == "texture") { out->type = SCENE_ASSET_TYPE_TEXTURE; } else if(values["type"] == "truetype") { out->type = SCENE_ASSET_TYPE_TRUETYPE_FONT; } else { *error = "Unknown asset type '" + values["type"] + "'"; return 1; } out->ref = values["ref"]; return 0; }