refactor font loading

This commit is contained in:
2019-12-01 18:24:59 +01:00
parent 0905827b8d
commit c8bce21b95
30 changed files with 180 additions and 84 deletions

View File

@@ -45,8 +45,6 @@ void NodeDialogBrowse::init_controls()
msgbox->btn_ok->on_click = [this,msgbox](Node*){
auto path = current->m_path;
int idx = container->get_child_index(current);
if (auto image_tex = current->find<NodeImageTexture>("thumb-tex"))
image_tex->tex.destroy();
container->remove_child(current);
if (!container->m_children.empty())
{
@@ -106,11 +104,6 @@ void NodeDialogBrowse::init_controls()
void NodeDialogBrowse::clear_list()
{
for (auto& n : container->m_children)
{
if (auto item = std::static_pointer_cast<NodeDialogBrowseItem>(n))
item->m_thumb->tex.destroy();
}
container->remove_all_children();
}
@@ -153,8 +146,8 @@ void NodeDialogBrowse::init_list()
// load thumb
if (auto image_tex = node->find<NodeImageTexture>("thumb-tex"))
{
image_tex->tex.destroy();
image_tex->tex.create(thumb);
image_tex->tex = std::make_shared<Texture2D>();
image_tex->tex->create(thumb);
}
container->add_child(node);
}