improve text input
This commit is contained in:
@@ -14,7 +14,7 @@ void NodeText::clone_copy(Node* dest) const
|
||||
NodeText* n = static_cast<NodeText*>(dest);
|
||||
n->m_text_mesh.max_width = m_text_mesh.max_width;
|
||||
n->m_text_mesh.create();
|
||||
n->m_text_mesh.update(font_id, m_text.c_str());
|
||||
n->m_text_mesh.update(font_id, m_text);
|
||||
n->m_text = m_text;
|
||||
n->m_font = m_font;
|
||||
n->m_color = m_color;
|
||||
@@ -31,7 +31,7 @@ void NodeText::create()
|
||||
sprintf(font, "%s-%d", m_font.c_str(), m_font_size);
|
||||
font_id = (kFont)const_hash(font);
|
||||
m_text_mesh.create();
|
||||
m_text_mesh.update(font_id, m_text.c_str());
|
||||
m_text_mesh.update(font_id, m_text);
|
||||
SetSize(m_text_mesh.bb);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ void NodeText::set_font(kFont fontID)
|
||||
{
|
||||
font_id = fontID;
|
||||
m_text_mesh.create();
|
||||
m_text_mesh.update(font_id, m_text.c_str());
|
||||
m_text_mesh.update(font_id, m_text);
|
||||
SetSize(m_text_mesh.bb);
|
||||
}
|
||||
|
||||
@@ -116,5 +116,6 @@ void NodeText::draw()
|
||||
|
||||
void NodeText::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)
|
||||
{
|
||||
m_text_mesh.update(font_id, m_text.c_str());
|
||||
if (old_size != new_size)
|
||||
m_text_mesh.update(font_id, m_text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user