added text widget parsing and rendering
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user