fix pixel snapping, add loaded event, remove default border thickness
This commit is contained in:
@@ -113,6 +113,7 @@ class LayoutManager
|
||||
std::string m_path;
|
||||
struct stat m_file_info { 0 };
|
||||
public:
|
||||
std::function<void()> on_loaded;
|
||||
bool load(const char* path);
|
||||
bool reload();
|
||||
class Node& operator[](uint16_t id) { return *m_layouts[id]; }
|
||||
@@ -182,15 +183,15 @@ public:
|
||||
}
|
||||
void SetPosition(float l, float t, float r, float b)
|
||||
{
|
||||
YGNodeStyleSetPadding(y_node, YGEdgeTop, t);
|
||||
YGNodeStyleSetPadding(y_node, YGEdgeRight, r);
|
||||
YGNodeStyleSetPadding(y_node, YGEdgeBottom, b);
|
||||
YGNodeStyleSetPadding(y_node, YGEdgeLeft, l);
|
||||
YGNodeStyleSetPosition(y_node, YGEdgeTop, t);
|
||||
YGNodeStyleSetPosition(y_node, YGEdgeRight, r);
|
||||
YGNodeStyleSetPosition(y_node, YGEdgeBottom, b);
|
||||
YGNodeStyleSetPosition(y_node, YGEdgeLeft, l);
|
||||
}
|
||||
void SetPosition(float l, float t)
|
||||
{
|
||||
YGNodeStyleSetPadding(y_node, YGEdgeTop, t);
|
||||
YGNodeStyleSetPadding(y_node, YGEdgeLeft, l);
|
||||
YGNodeStyleSetPosition(y_node, YGEdgeTop, t);
|
||||
YGNodeStyleSetPosition(y_node, YGEdgeLeft, l);
|
||||
}
|
||||
|
||||
void SetFlexGrow(float value) { YGNodeStyleSetFlexGrow(y_node, value); }
|
||||
@@ -285,7 +286,7 @@ public:
|
||||
static Plane m_plane;
|
||||
glm::vec4 m_color{ 0, 0, 0, 1 };
|
||||
glm::vec4 m_border_color{ 1, 1, 1, 1 };
|
||||
float m_thinkness{ 1 };
|
||||
float m_thinkness{ 0 };
|
||||
static void static_init()
|
||||
{
|
||||
m_plane.create<1>(1, 1);
|
||||
@@ -342,9 +343,12 @@ public:
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, m_color);
|
||||
m_plane.draw_fill();
|
||||
|
||||
glLineWidth(m_thinkness);
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, m_border_color);
|
||||
m_plane.draw_stroke();
|
||||
if (m_thinkness > 0)
|
||||
{
|
||||
glLineWidth(m_thinkness);
|
||||
ShaderManager::u_vec4(kShaderUniform::Col, m_border_color);
|
||||
m_plane.draw_stroke();
|
||||
}
|
||||
|
||||
if (m_color.a != 1.f)
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
Reference in New Issue
Block a user