added text widget parsing and rendering

This commit is contained in:
2017-02-06 23:32:01 +00:00
parent fd7f62693e
commit 3cc25e7592
7 changed files with 130 additions and 32 deletions

View File

@@ -47,7 +47,11 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj)
glm::mat4 scale = glm::scale(glm::vec3(m_size, 1.f));
glm::mat4 pos = glm::translate(glm::vec3(m_pos, 0));
m_widget->mvp = proj * pos * scale * pivot;
m_widget->pos = pos;
m_widget->scale = scale;
m_widget->proj = proj;
m_widget->clip = m_clip;
m_widget->update();
}
for (auto& c : m_children)
c.update_internal(m_pos, proj);
@@ -184,6 +188,9 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
case kWidget::Shape:
m_widget = std::make_unique<WidgetShape>();
break;
case kWidget::Text:
m_widget = std::make_unique<WidgetText>();
break;
}
while (attr)
@@ -195,6 +202,9 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
if (m_widget)
m_widget->create();
if (widget_id == kWidget::Text)
SetSize(((WidgetText*)m_widget.get())->m_text_mesh.bb);
auto x_child = x_node->FirstChildElement();
while (x_child)
{