Вопрос Imgui рисуется снизу из-за табов

  • Автор темы Автор темы kesker
  • Дата начала Дата начала
Пользователь
Пользователь
Статус
Оффлайн
Регистрация
26 Фев 2020
Сообщения
329
Реакции
31
хотел сделать меню, но столкнулся с проблемой, которую мой пастерский мозг пока что не может осилить.
табы у меня сделаны через кнопки и отрисовываются слева меню, вертикально. Так как табы вызваны сначало, а потом уже само содержимое, содержимое рендериться под табами, а не справа.

Код:
Expand Collapse Copy
 static float f = 0.0f;
            static int counter = 0;
            static bool checkboxactive1 = false;
            static bool checkboxactive2 = true;
            static bool checkboxactive3 = false;
            static int fovaimbot = 0;


            bool fill; // bool for filling ImGui::Begin
            bool flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysUseWindowPadding /*xz*/ | ImGuiWindowFlags_NoFocusOnAppearing;
            ImGui::Begin("Menu", &fill, flags);                          // Create a window called "Hello, world!" and append into it.

            ImVec2 p = ImGui::GetWindowPos();
           // ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 0, p.y + 0), ImVec2(p.x + 730, p.y + 4), ImColor(0.000000f, 0.000000f, 1.000000f, 1.000000f), 0, 15); // poloska
            ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x , p.y), ImVec2(p.x + 720, p.y + 6), ImColor(100, 100, 255, 255), 0, 15.f); // poloska
            ImGui::Spacing();
            ImGui::Text(u8" name hack");
            ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 0, p.y + 23), ImVec2(p.x + 730, p.y + 25), ImColor(50, 50, 50, 255), 0, 15); // 1

            //ImGui::Spacing();

            static int switchTabs = 0;

            if (ImGui::Button("Aimbot", ImVec2(110.0f, 25.0f))) // ImVec2(100.0f, 0.0f)))
                switchTabs = 1;
            //ImGui::SameLine(0.0, 2.0f);
            //ImGui::Spacing();
            if (ImGui::Button("Visuals", ImVec2(110.0f, 25.0f)))
                switchTabs = 2;
           //ImGui::SameLine(0.0, 2.0f); // 0.0, 2.0
           // ImGui::Spacing();
            if (ImGui::Button("Misc", ImVec2(110.0f, 25.0f)))
                switchTabs = 3;

            ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 113, p.y + 25), ImVec2(p.x + 115, p.y + 458), ImColor(50, 50, 50, 255), 0, 15); // 3
            
           // ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 0, p.y + 50), ImVec2(p.x + 114, p.y + 52), ImColor(50, 50, 50, 255), 0, 15); // 1             ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 0, p.y + 52), ImVec2(p.x + 114, p.y + 54), ImColor(50, 50, 50, 255), 0, 15); // 1
           // ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 0, p.y + 79), ImVec2(p.x + 114, p.y + 81), ImColor(50, 50, 50, 255), 0, 15); // 1
          //  ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 0, p.y + 102), ImVec2(p.x + 114, p.y + 104), ImColor(50, 50, 50, 255), 0, 15); // 1  ПОЛОСКИ МЕЖДУ ТАБАМИ



            
            ImGui::SameLine(125);
            switch (switchTabs) {
            case 0:
                ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize(u8"Changelog:").x) / 2);
                ImGui::Text(u8"Changelog:");

                /*ImGui::Text(u8"-sdgsdg");
                ImGui::Text(u8"-sfgfsgsg42");
                ImGui::Text(u8"-sfg52g25g");
                ImGui::Text(u8"-2ggsfgsg52g");*/

                break;
            case 1:
                ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 108, p.y + 25), ImVec2(p.x + 113, p.y + 50), ImColor(100, 100, 255, 255), 0, 15); // 4
                ImGui::SameLine(125);
                ImGui::Checkbox("Enable", &checkboxactive1);
                ImGui::SameLine(210);
                ImGui::SliderInt("Fov", &fovaimbot, 0, 50);
                break;
            case 2:
                ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 108, p.y + 54), ImVec2(p.x + 113, p.y + 79), ImColor(100, 100, 255, 255), 0, 15); // 5
                ImGui::Checkbox("Checkbox3", &checkboxactive2);
                break;
            case 3:
                ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 108, p.y + 83), ImVec2(p.x + 113, p.y + 108), ImColor(100, 100, 255, 255), 0, 15); // 5
                ImGui::SameLine(125);
                ImGui::Checkbox("123", &checkboxactive2);
                ImGui::SameLine(300);
                ImGui::Checkbox("321", &checkboxactive2);

                break;
            }

            ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x + 0, p.y + 458), ImVec2(p.x + 730, p.y + 460), ImColor(50, 50, 50, 255), 0, 15); // 2

            ImGui::End();
        }
И вот что у меня получается. Табы начинают рендериться не с самого начала, возле миска (нужно чтобы возле таба имбота (ниже скрин думаю понятный будет))
1602743561829.png


Вот как нужно мне.
меню как надо.png

Помогите пожалуйста)
 
где проблема то,я нихуя не вижу чет
если хочешь рендерить их где-то юзаешь Imgui::begingroup и допустим их в закидываешь в Imgui::beginchild
чтобы поставить позицию юзай Imgui::setcursorpos
 
где проблема то,я нихуя не вижу чет
если хочешь рендерить их где-то юзаешь Imgui::begingroup и допустим их в закидываешь в Imgui::beginchild
чтобы поставить позицию юзай Imgui::setcursorpos
спасибо. я про проблему того, что чекбоксы, слайдер рендерятся около миск или ниже. а надо чтобы рендерились сразу, возле таба аимбот
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Код:
Expand Collapse Copy
ImGui::BeginGroup();
{
//tabs
}
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
{
//content
}
ImGui::EndGroup();
 
Назад
Сверху Снизу