added temporary ID for some node

This commit is contained in:
Lendemor 2018-06-06 15:16:49 +02:00
parent ec53ae08f2
commit c393ba8438
3 changed files with 13 additions and 2 deletions

View File

@ -20,6 +20,8 @@ ButtonNode::ButtonNode(ButtonShape* shape):
m_shape(shape),
m_label(new LabelNode())
{
m_label->setID("label");
m_shape->getBackGround()->setID("background");
addChild(m_shape->getBackGround());
addChild(m_label);
}

View File

@ -304,7 +304,7 @@ void SceneNode::openInfoWindow()
void SceneNode::gui()
{
if(m_showInfo & m_id != "undefined id")
if(m_showInfo & (m_id != "undefined id"))
{
bool enabled = true;
std::string window_name("Node info##"+m_id);
@ -316,11 +316,19 @@ void SceneNode::gui()
if(ImGui::Button("Show Parent Info"))
m_parent->openInfoWindow();
}
ImGui::Separator();
ImGui::Text("Children :");
for(SceneNode* child : m_children){
if(ImGui::Button(child->getID().data()))
child->openInfoWindow();
ImGui::SameLine();
}
ImGui::NewLine();
ImGui::Separator();
bool visible = isVisible();
// setVisible(ImGui::Checkbox("Visible",&visible));
if(ImGui::Checkbox("Visible",&visible))
setVisible(visible);
ImGui::End();
if(!enabled)
m_showInfo = false;

View File

@ -342,6 +342,7 @@ public:
engine->createScene(m_menu_scene);
SceneTree* scene = RESOURCE_GET(SceneTree,m_menu_scene);
m_button_demo = new ButtonNode(new RectangleButtonShape(glm::vec2(300,100)));
m_button_demo->setID("startbutton");
m_button_demo->getLabel()->setText("Start DEMO");
m_button_demo->getLabel()->setColor(glm::vec3(1.,1.,1.));
m_button_demo->getBackGround()->setColor(glm::vec3(0.88,0.05,0.05));