added settings popup and icon node
This commit is contained in:
@@ -122,6 +122,9 @@ void App::init()
|
||||
FontManager::init();
|
||||
FontManager::load(kFont::Arial_11, ttf, 15);
|
||||
FontManager::load(kFont::Arial_30, ttf, 30);
|
||||
NodeBorder::static_init();
|
||||
NodeImage::static_init();
|
||||
NodeIcon::static_init();
|
||||
|
||||
layout.on_loaded = [&] {
|
||||
layout[main_id].update(width, height);
|
||||
@@ -136,9 +139,34 @@ void App::init()
|
||||
msgbox->m_manager = &layout;
|
||||
msgbox->init();
|
||||
layout[main_id].add_child(msgbox);
|
||||
layout[main_id].update(width, height);
|
||||
layout[main_id].update();
|
||||
};
|
||||
}
|
||||
if (auto* button = layout[main_id].find<NodeButtonCustom>("btn-settings"))
|
||||
{
|
||||
button->on_click = [this] {
|
||||
settings = new NodeSettings();
|
||||
settings->m_manager = &layout;
|
||||
settings->init();
|
||||
layout[main_id].add_child(settings);
|
||||
layout[main_id].update();
|
||||
};
|
||||
}
|
||||
if (auto* menu_file = layout[main_id].find<NodeButtonCustom>("menu-file"))
|
||||
{
|
||||
menu_file->on_click = [=] {
|
||||
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
||||
popup = (NodePopupMenu*)layout[const_hash("popup-menu")].m_children[0]->clone();
|
||||
popup->SetPositioning(YGPositionTypeAbsolute);
|
||||
popup->SetPosition(pos.x, pos.y);
|
||||
layout[main_id].add_child(popup);
|
||||
layout[main_id].update();
|
||||
};
|
||||
}
|
||||
if (auto* toolbar = layout[main_id].find<Node>("toolbar"))
|
||||
{
|
||||
toolbar->m_flood_events = true;
|
||||
}
|
||||
};
|
||||
layout.load("data/layout.xml");
|
||||
|
||||
@@ -152,8 +180,6 @@ void App::init()
|
||||
ShaderManager::create(kShader::UVs, shader_v, shader_uv_f);
|
||||
ShaderManager::create(kShader::Font, shader_font_v, shader_font_f);
|
||||
ShaderManager::create(kShader::Atlas, shader_atlas_v, shader_atlas_f);
|
||||
NodeBorder::static_init();
|
||||
NodeImage::static_init();
|
||||
|
||||
if (!tex.load("data/uvs.jpg"))
|
||||
printf("error loading image\n");
|
||||
@@ -239,7 +265,6 @@ void App::mouse_down(int button, float x, float y)
|
||||
popup->SetPositioning(YGPositionTypeAbsolute);
|
||||
popup->SetPosition(x, y);
|
||||
layout[main_id].add_child(popup);
|
||||
layout[main_id].update(width, height);
|
||||
}
|
||||
layout[main_id].update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user