add tick and on_tick event, fix unsaved document prompt, implement TextInput blinking cursor
This commit is contained in:
24
src/node.cpp
24
src/node.cpp
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user