Font loading & text node

This commit is contained in:
Antoine Pilote
2021-06-04 16:01:19 -04:00
parent 49cfe9e421
commit 800d6fb8a1
9 changed files with 735 additions and 46 deletions

View File

@@ -1,3 +1,29 @@
#include "InterfaceParser.h"
Ref<Canvas> InterfaceParser::Root = CreateRef<Canvas>();
Ref<Canvas> InterfaceParser::Root = CreateRef<Canvas>();
void InterfaceParser::Iterate(const pugi::xml_node& xml_node, Ref<Node> node)
{
for (auto& e : xml_node.children())
{
std::string type = e.name();
if (type == "Canvas")
{
Ref<Canvas> canvas = CreateCanvas(e);
node->Childrens.push_back(canvas);
Iterate(e, canvas);
}
else if (type == "Rect")
{
Ref<Node> newNode = CreateNode(e);
node->Childrens.push_back(newNode);
Iterate(e, newNode);
}
else if (type == "p")
{
Ref<TextNode> textnode = CreateTextNode(e);
node->Childrens.push_back(textnode);
Iterate(e, textnode);
}
}
}