fix pixel snapping, add loaded event, remove default border thickness
This commit is contained in:
@@ -87,8 +87,8 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj)
|
||||
float y = YGNodeLayoutGetTop(y_node);
|
||||
float w = YGNodeLayoutGetWidth(y_node);
|
||||
float h = YGNodeLayoutGetHeight(y_node);
|
||||
m_pos = origin + glm::vec2(x, y);
|
||||
m_size = glm::vec2(w, h);
|
||||
m_pos = glm::floor(origin + glm::vec2(x, y));
|
||||
m_size = glm::ceil(glm::vec2(w, h));
|
||||
|
||||
if (parent)
|
||||
{
|
||||
@@ -110,8 +110,8 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj)
|
||||
}
|
||||
|
||||
glm::mat4 pivot = glm::translate(glm::vec3(.5f, .5f, 0.f));
|
||||
glm::mat4 scale = glm::scale(glm::vec3(glm::ceil(m_size), 1.f));
|
||||
glm::mat4 pos = glm::translate(glm::vec3(glm::floor(m_pos), 0));
|
||||
glm::mat4 scale = glm::scale(glm::vec3(m_size, 1.f));
|
||||
glm::mat4 pos = glm::translate(glm::vec3(m_pos, 0));
|
||||
m_mvp = proj * pos * scale * pivot;
|
||||
m_proj = proj;
|
||||
for (auto& c : m_children)
|
||||
@@ -463,6 +463,8 @@ bool LayoutManager::load(const char* path)
|
||||
}
|
||||
current = current->NextSiblingElement("layout");
|
||||
}
|
||||
if (on_loaded)
|
||||
on_loaded();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user