add tick and on_tick event, fix unsaved document prompt, implement TextInput blinking cursor

This commit is contained in:
2018-10-08 01:00:49 +02:00
parent e2069fadca
commit c9c7b9f1c4
19 changed files with 226 additions and 46 deletions

View File

@@ -483,6 +483,23 @@ glm::vec4 Node::GetPadding() const
return{ t, r, b, l };
}
void Node::SetMargin(float t, float r, float b, float l)
{
YGNodeStyleSetMargin(y_node, YGEdgeTop, t);
YGNodeStyleSetMargin(y_node, YGEdgeRight, r);
YGNodeStyleSetMargin(y_node, YGEdgeBottom, b);
YGNodeStyleSetMargin(y_node, YGEdgeLeft, l);
}
glm::vec4 Node::GetMargin() const
{
float t = YGNodeLayoutGetMargin(y_node, YGEdgeTop);
float r = YGNodeLayoutGetMargin(y_node, YGEdgeRight);
float b = YGNodeLayoutGetMargin(y_node, YGEdgeBottom);
float l = YGNodeLayoutGetMargin(y_node, YGEdgeLeft);
return{ t, r, b, l };
}
void Node::SetPosition(const glm::vec2 pos)
{
SetPosition(pos.x, pos.y);
@@ -656,6 +673,13 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj)
c->update_internal(m_pos, proj);
}
void Node::tick(float dt)
{
for (auto& c : m_children)
c->tick(dt);
on_tick(dt);
}
void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr)
{
switch (ka)