Dawn/archive/dawntools/util/parser/SceneItemParser.hpp
2023-10-31 21:15:03 -05:00

56 lines
1.5 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "util/parser/SceneItemComponentParser.hpp"
#include "util/parser/SceneAssetParser.hpp"
#include "util/parser/SceneCodeParser.hpp"
namespace Dawn {
enum SceneItemDependencyType {
SCENE_ITEM_DEPENDENCY_TYPE_ITEM,
SCENE_ITEM_DEPENDENCY_TYPE_COMPONENT,
SCENE_ITEM_DEPENDENCY_TYPE_CODE,
};
struct SceneItemDependency {
enum SceneItemDependencyType type;
size_t position;
};
struct SceneItem {
struct SceneItemComponentRegistry *registry;
std::string ref;
std::string position;
std::string alignment;
std::string alignX;
std::string alignY;
std::string lookAtPosition;
std::string lookAtTarget;
std::string scale;
std::string prefab;
std::string menuX;
std::string menuY;
std::string label;
std::vector<struct SceneItemComponent> components;
std::vector<struct SceneItem> children;
std::vector<struct SceneAsset> assets;
std::vector<struct SceneCode> code;
std::vector<struct SceneItemDependency> dependencies;
};
class SceneItemParser : public XmlParser<struct SceneItem> {
protected:
std::vector<std::string> getRequiredAttributes() override;
std::map<std::string, std::string> getOptionalAttributes() override;
int32_t onParse(
Xml *node,
std::map<std::string, std::string> values,
struct SceneItem *out,
std::string *error
) override;
};
}