added slider, mouse capture in Node, desaturated icons
This commit is contained in:
@@ -13,6 +13,25 @@ App App::I; // singleton
|
||||
#define SHADER_VERSION "#version 150\n"
|
||||
#endif
|
||||
|
||||
static std::vector<std::string> FindAllBrushes(std::string folder)
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
std::string search_path = folder + "*.png";
|
||||
WIN32_FIND_DATAA fd;
|
||||
HANDLE hFind = ::FindFirstFileA(search_path.c_str(), &fd);
|
||||
if (hFind != INVALID_HANDLE_VALUE) {
|
||||
do {
|
||||
// read all (real) files in current folder
|
||||
// , delete '!' read other 2 default folder . and ..
|
||||
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
names.push_back(fd.cFileName);
|
||||
}
|
||||
} while (::FindNextFileA(hFind, &fd));
|
||||
::FindClose(hFind);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
void App::create()
|
||||
{
|
||||
@@ -150,6 +169,23 @@ void App::initLayout()
|
||||
|
||||
layout.on_loaded = [&] {
|
||||
LOG("initializing layout updating after load");
|
||||
static auto icons = FindAllBrushes("data\\Icons\\");
|
||||
if (auto* container = layout[main_id]->find<NodeBorder>("brushes"))
|
||||
{
|
||||
if (auto* tpl = layout[const_hash("tpl-brush-icon")])
|
||||
{
|
||||
for (auto& i : icons)
|
||||
{
|
||||
NodeButtonCustom* btn = (NodeButtonCustom*)tpl->m_children[0]->clone();
|
||||
NodeImage* img = (NodeImage*)btn->m_children[0].get();
|
||||
img->m_path = "data\\Icons\\" + i;
|
||||
img->m_tex_id = const_hash(img->m_path.c_str());
|
||||
img->create();
|
||||
container->add_child(btn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layout[main_id]->update(width, height, zoom);
|
||||
LOG("initializing layout components");
|
||||
sidebar = layout[main_id]->find<NodeBorder>("sidebar");
|
||||
|
||||
Reference in New Issue
Block a user