Вопрос П0могите молодому

Тьомчик
Пользователь
Статус
Оффлайн
Регистрация
30 Июн 2020
Сообщения
700
Реакции[?]
148
Поинты[?]
56K
короче в крация.
удалил визуалку скачал и сломалась конфиг система
вот код
Код:
        else if (tab == 4)
        {
            ImGui::SetCursorPos({ 132, 5 });
            ImGui::BeginChild("##1", { 166,276 });
            {

                static int selected = 0;
                static char cfgName[32];

                std::vector<std::string> cfgList;
                ReadDirectory(g_Options.folder, cfgList);
                if (!cfgList.empty())
                {
                    ImGui::Spacing();
                    ImGui::SameLine();
                    ImGui::InputText("##configname", cfgName, 24);
                    //ImGui::SameLine();
                    if (ImGui::Button("Create Config", ImVec2(160, 20)))
                    {
                        if (strlen(cfgName))
                            g_Options.SaveSettings(cfgName + std::string(".ini"));
                    }
                    if (ImGui::Button("Save", ImVec2(160, 20)))
                    {
                        g_Options.SaveSettings(cfgList[selected]);
                    }
                    if (ImGui::Button("Load", ImVec2(160, 20))) {
                        g_Options.LoadSettings(cfgList[selected]);
                    }
                    if (ImGui::Button("Unload", ImVec2(160, 20))) {
                        g_Unload = true;
                    }
                    if (ImGui::Button("Delete Config", ImVec2(160, 20))) {
                        g_Options.DeleteSettings(cfgList[selected]);
                        selected = 0;
                    }
                    //    ImGui::Separator();
                }
                ImGui::PopItemWidth();
            }

            ImGui::EndChild();

            ImGui::SetCursorPos({ 302, 5 });
            ImGui::BeginChild("##2", { 166,276 });
            {

                static int selected = 0;
                static char cfgName[64];

                std::vector<std::string> cfgList;
                ReadDirectory(g_Options.folder, cfgList);
                ImGui::PushItemWidth(150.f);
                if (!cfgList.empty())
                {
                    ImGui::ListBoxHeader("##SelectConfig", ImVec2(-1, 505)); cfgList[selected].c_str();
                    {
                        for (size_t i = 0; i < cfgList.size(); i++)
                        {
                            if (ImGui::Selectable(cfgList[i].c_str(), i == selected)){
                                selected = i;}
                        }
                        ImGui::ListBoxFooter();
                        ImGui::Spacing();
                    }
                }
                ImGui::EndChild();
            }
        }
Screenshot_1.png
 
Участник
Статус
Оффлайн
Регистрация
26 Мар 2019
Сообщения
707
Реакции[?]
167
Поинты[?]
1K
короче в крация.
удалил визуалку скачал и сломалась конфиг система
вот код
Код:
        else if (tab == 4)
        {
            ImGui::SetCursorPos({ 132, 5 });
            ImGui::BeginChild("##1", { 166,276 });
            {

                static int selected = 0;
                static char cfgName[32];

                std::vector<std::string> cfgList;
                ReadDirectory(g_Options.folder, cfgList);
                if (!cfgList.empty())
                {
                    ImGui::Spacing();
                    ImGui::SameLine();
                    ImGui::InputText("##configname", cfgName, 24);
                    //ImGui::SameLine();
                    if (ImGui::Button("Create Config", ImVec2(160, 20)))
                    {
                        if (strlen(cfgName))
                            g_Options.SaveSettings(cfgName + std::string(".ini"));
                    }
                    if (ImGui::Button("Save", ImVec2(160, 20)))
                    {
                        g_Options.SaveSettings(cfgList[selected]);
                    }
                    if (ImGui::Button("Load", ImVec2(160, 20))) {
                        g_Options.LoadSettings(cfgList[selected]);
                    }
                    if (ImGui::Button("Unload", ImVec2(160, 20))) {
                        g_Unload = true;
                    }
                    if (ImGui::Button("Delete Config", ImVec2(160, 20))) {
                        g_Options.DeleteSettings(cfgList[selected]);
                        selected = 0;
                    }
                    //    ImGui::Separator();
                }
                ImGui::PopItemWidth();
            }

            ImGui::EndChild();

            ImGui::SetCursorPos({ 302, 5 });
            ImGui::BeginChild("##2", { 166,276 });
            {

                static int selected = 0;
                static char cfgName[64];

                std::vector<std::string> cfgList;
                ReadDirectory(g_Options.folder, cfgList);
                ImGui::PushItemWidth(150.f);
                if (!cfgList.empty())
                {
                    ImGui::ListBoxHeader("##SelectConfig", ImVec2(-1, 505)); cfgList[selected].c_str();
                    {
                        for (size_t i = 0; i < cfgList.size(); i++)
                        {
                            if (ImGui::Selectable(cfgList[i].c_str(), i == selected)){
                                selected = i;}
                        }
                        ImGui::ListBoxFooter();
                        ImGui::Spacing();
                    }
                }
                ImGui::EndChild();
            }
        }
Посмотреть вложение 125790
Визуалка мусор
 
Участник
Статус
Оффлайн
Регистрация
26 Апр 2018
Сообщения
852
Реакции[?]
181
Поинты[?]
0
Тьомчик
Пользователь
Статус
Оффлайн
Регистрация
30 Июн 2020
Сообщения
700
Реакции[?]
148
Поинты[?]
56K
а как ты создал табы, если это твое меню в имгуи там на самом верху прописаны все табы активные и не активные
оно
ImGui::SetCursorPos(ImVec2{ 5 , 505 });
if (Tab("Config", { 125.f, 125.f }, tab == 4))
tab = 4;
 
Сверху Снизу