diff --git a/data/layout.xml b/data/layout.xml index 1d49482..8603411 100644 --- a/data/layout.xml +++ b/data/layout.xml @@ -1,4 +1,5 @@ - + + diff --git a/engine/app.cpp b/engine/app.cpp index 2fc3d8f..54e9d7b 100644 --- a/engine/app.cpp +++ b/engine/app.cpp @@ -53,10 +53,32 @@ void App::init() " frag = col;" "}"; + auto y_root = YGNodeNew(); tinyxml2::XMLDocument xml; auto ret = xml.LoadFile("data\\layout.xml"); auto root = xml.RootElement(); -// root-> + auto child = root->FirstChildElement(); + while (child) + { + printf("Element %s: ", child->Name()); + auto attr = child->FirstAttribute(); + auto y_node = YGNodeNew(); + YGNodeInsertChild(y_root, y_node, 0); + while (attr) + { + printf("%s=%s ", attr->Name(), attr->Value()); + if (strcmp("width", attr->Name()) == 0) + { + if (strchr(attr->Value(), '%')) + YGNodeStyleSetWidthPercent(y_node, attr->FloatValue()); + else + YGNodeStyleSetWidth(y_node, attr->FloatValue()); + } + attr = attr->Next(); + } + printf("\n"); + child = child->NextSiblingElement(); + } shader.create(shader_v, shader_f); shader_color.create(shader_color_v, shader_color_f);