fixed label node depth issue
This commit is contained in:
parent
46f3d32b54
commit
e596ffef52
@ -16,7 +16,7 @@ BackGroundNode::BackGroundNode(glm::vec2 dimension, glm::vec3 color, float opaci
|
||||
m_opacity(opacity),
|
||||
m_opacity_updated(false)
|
||||
{
|
||||
Mesh* mesh = new Mesh();
|
||||
Mesh* mesh = new Mesh("background");
|
||||
mesh->addRectangle2D(glm::vec2(0),dimension);
|
||||
PhongMaterial *mat = new PhongMaterial();
|
||||
mat->diffuse = color;
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#define LABEL_TEXT_DEPTH 15
|
||||
|
||||
LabelNode::LabelNode():
|
||||
m_string(""),
|
||||
m_color(glm::vec3(1,1,1))
|
||||
@ -14,7 +16,7 @@ LabelNode::LabelNode():
|
||||
Font* font = RESOURCE_GET(Font,"shellfont");
|
||||
m_text = font->getTextNode(m_string,m_color,32);
|
||||
if(m_text){
|
||||
m_text->setDepth(15);
|
||||
m_text->setDepth(LABEL_TEXT_DEPTH);
|
||||
addChild(m_text);
|
||||
}
|
||||
}
|
||||
@ -46,10 +48,15 @@ void LabelNode::update(){
|
||||
if(m_was_updated)
|
||||
m_was_updated = false;
|
||||
if(m_string_updated){
|
||||
removeChild(m_text);
|
||||
delete(m_text);
|
||||
if(m_text != nullptr)
|
||||
{
|
||||
removeChild(m_text);
|
||||
delete(m_text);
|
||||
}
|
||||
Font* font = RESOURCE_GET(Font,"shellfont");
|
||||
m_text = font->getTextNode(m_string,m_color,32);
|
||||
m_text->setDepth(LABEL_TEXT_DEPTH);
|
||||
m_text->getGeometryNode()->mesh->setName("labelText");
|
||||
addChild(m_text);
|
||||
m_string_updated= false;
|
||||
m_color_updated=false;
|
||||
|
@ -17,7 +17,7 @@ ScrollBarNode::ScrollBarNode(glm::vec2 dimension, glm::vec3 bar_color):
|
||||
m_bar_resized(false),
|
||||
m_bar_moved(false)
|
||||
{
|
||||
Mesh* mesh = new Mesh();
|
||||
Mesh* mesh = new Mesh("scrollbar");
|
||||
mesh->addRectangle2D(glm::vec2(0),m_dimension);
|
||||
PhongMaterial* mat = new PhongMaterial();
|
||||
mat->diffuse = m_bar_color;
|
||||
|
@ -78,6 +78,9 @@ void SparrowShell::out(std::string str,glm::vec3 color)
|
||||
{
|
||||
Font *shellfont = RESOURCE_GET(Font,"shellfont");
|
||||
TextNode* tnode = shellfont->getTextNode(str,color,m_buffer->getFontSize(),false);
|
||||
std::string name = "shellTextLine";
|
||||
name += m_buffer->size();
|
||||
tnode->getGeometryNode()->mesh->setName(name);
|
||||
tnode->setDepth(SHELL_DEPTH+1);
|
||||
m_buffer->push(tnode);
|
||||
scrollDown();
|
||||
|
Loading…
x
Reference in New Issue
Block a user