Гайд Как создать табы для вашего чита

Эксперт
Эксперт
Статус
Оффлайн
Регистрация
30 Дек 2019
Сообщения
1,966
Реакции
958
Салам колекам, сегодня я скажу как сделать табы для меню вашей пасты(высококачественного самописа).
Код:
Expand Collapse Copy
static int selected_Tab = 0;
static const char* items[3] = { "1", "2", "3" };
В скобках "", вмест0 1, 2, 3, вписать названия табов
Код:
Expand Collapse Copy
ImGui::SelectTabs(&selected_Tab, items, 3);
                switch (selected_Tab) {
                case 0:
                    ImGui::Text(u8"POSHEL");
                    break;
                case 1:
                    ImGui::Text(u8"NAHUY");
                    break;
                case 2:
                    ImGui::Text(u8"PIDORAS");
                    break;
                }
Код:
Expand Collapse Copy
void SelectTabs(int *selected, const char* items[], int item_count, ImVec2 size = ImVec2(0, 0))
    {
        auto color_grayblue = GetColorU32(ImVec4(0.35, 0.2, 0.2, 0.30));
        auto color_deepblue = GetColorU32(ImVec4(0.15, 0.1, 0.1, 0.30));
        auto color_shade_hover = GetColorU32(ImVec4(1, 1, 1, 0.05));
        auto color_shade_clicked = GetColorU32(ImVec4(0.8, 0.8, 1, 0.1));
        auto color_black_outlines = GetColorU32(ImVec4(0.05, 0, 0, 0.8));

        ImGuiStyle &style = GetStyle();
        ImGuiWindow* window = GetCurrentWindow();
        if (window->SkipItems)
            return;

        std::string names;
        for (int32_t i = 0; i < item_count; i++)
            names += items[i];

        ImGuiContext* g = GImGui;
        const ImGuiID id = window->GetID(names.c_str());
        const ImVec2 label_size = CalcTextSize(names.c_str(), NULL, true);

        ImVec2 Min = window->DC.CursorPos;
        ImVec2 Max = ((size.x <= 0 || size.y <= 0) ? ImVec2(Min.x + GetContentRegionMax().x - style.WindowPadding.x, Min.y + label_size.y * 2) : Min + size);

        ImRect bb(Min, Max);
        ItemSize(bb, style.FramePadding.y);
        if (!ItemAdd(bb, id))
            return;

        PushClipRect(ImVec2(Min.x, Min.y - 1), ImVec2(Max.x, Max.y + 1), false);

        window->DrawList->AddRectFilledMultiColor(Min, Max, color_grayblue, color_grayblue, color_deepblue, color_deepblue); // Main gradient.

        ImVec2 mouse_pos = GetMousePos();
        bool mouse_click = g->IO.MouseClicked[0];

        float TabSize = ceil((Max.x - Min.x) / item_count);

        for (int32_t i = 0; i < item_count; i++)
        {
            ImVec2 Min_cur_label = ImVec2(Min.x + (int)TabSize * i, Min.y);
            ImVec2 Max_cur_label = ImVec2(Min.x + (int)TabSize * i + (int)TabSize, Max.y);

            // Imprecision clamping. gay but works :^)
            Max_cur_label.x = (Max_cur_label.x >= Max.x ? Max.x : Max_cur_label.x);

            if (mouse_pos.x > Min_cur_label.x && mouse_pos.x < Max_cur_label.x &&
                mouse_pos.y > Min_cur_label.y && mouse_pos.y < Max_cur_label.y)
            {
                if (mouse_click)
                    *selected = i;
                else if (i != *selected)
                    window->DrawList->AddRectFilled(Min_cur_label, Max_cur_label, color_shade_hover);
            }

            if (i == *selected) {
                window->DrawList->AddRectFilled(Min_cur_label, Max_cur_label, color_shade_clicked);
                window->DrawList->AddRectFilledMultiColor(Min_cur_label, Max_cur_label, color_deepblue, color_deepblue, color_grayblue, color_grayblue);
                window->DrawList->AddLine(ImVec2(Min_cur_label.x - 1.5f, Min_cur_label.y - 1), ImVec2(Max_cur_label.x - 0.5f, Min_cur_label.y - 1), color_black_outlines);
            }
            else
                window->DrawList->AddLine(ImVec2(Min_cur_label.x - 1, Min_cur_label.y), ImVec2(Max_cur_label.x, Min_cur_label.y), color_black_outlines);
            window->DrawList->AddLine(ImVec2(Max_cur_label.x - 1, Max_cur_label.y), ImVec2(Max_cur_label.x - 1, Min_cur_label.y - 0.5f), color_black_outlines);

            const ImVec2 text_size = CalcTextSize(items[i], NULL, true);
            float pad_ = style.FramePadding.x + g->FontSize + style.ItemInnerSpacing.x;
            ImRect tab_rect(Min_cur_label, Max_cur_label);
            RenderTextClipped(Min_cur_label, Max_cur_label, items[i], NULL, &text_size, style.WindowTitleAlign, &tab_rect);
        }

        window->DrawList->AddLine(ImVec2(Min.x, Min.y - 0.5f), ImVec2(Min.x, Max.y), color_black_outlines);
        window->DrawList->AddLine(ImVec2(Min.x, Max.y), Max, color_black_outlines);
        PopClipRect();
    }
Не забудтe прописать ImGui::End();
А да, кстати, Вместо Текста в табах можно поставить ВСЁЁЁЁ ЧТО УГОДНО(даже фотку своего ху** кхмм)
 
А скриншот конечного результата? :LUL:
 
Салам колекам, сегодня я скажу как сделать табы для меню вашей пасты(высококачественного самописа).
Код:
Expand Collapse Copy
static int selected_Tab = 0;
static const char* items[3] = { "1", "2", "3" };
В скобках "", вмест0 1, 2, 3, вписать названия табов
Код:
Expand Collapse Copy
ImGui::SelectTabs(&selected_Tab, items, 3);
                switch (selected_Tab) {
                case 0:
                    ImGui::Text(u8"POSHEL");
                    break;
                case 1:
                    ImGui::Text(u8"NAHUY");
                    break;
                case 2:
                    ImGui::Text(u8"PIDORAS");
                    break;
                }
Код:
Expand Collapse Copy
void SelectTabs(int *selected, const char* items[], int item_count, ImVec2 size = ImVec2(0, 0))
    {
        auto color_grayblue = GetColorU32(ImVec4(0.35, 0.2, 0.2, 0.30));
        auto color_deepblue = GetColorU32(ImVec4(0.15, 0.1, 0.1, 0.30));
        auto color_shade_hover = GetColorU32(ImVec4(1, 1, 1, 0.05));
        auto color_shade_clicked = GetColorU32(ImVec4(0.8, 0.8, 1, 0.1));
        auto color_black_outlines = GetColorU32(ImVec4(0.05, 0, 0, 0.8));

        ImGuiStyle &style = GetStyle();
        ImGuiWindow* window = GetCurrentWindow();
        if (window->SkipItems)
            return;

        std::string names;
        for (int32_t i = 0; i < item_count; i++)
            names += items[i];

        ImGuiContext* g = GImGui;
        const ImGuiID id = window->GetID(names.c_str());
        const ImVec2 label_size = CalcTextSize(names.c_str(), NULL, true);

        ImVec2 Min = window->DC.CursorPos;
        ImVec2 Max = ((size.x <= 0 || size.y <= 0) ? ImVec2(Min.x + GetContentRegionMax().x - style.WindowPadding.x, Min.y + label_size.y * 2) : Min + size);

        ImRect bb(Min, Max);
        ItemSize(bb, style.FramePadding.y);
        if (!ItemAdd(bb, id))
            return;

        PushClipRect(ImVec2(Min.x, Min.y - 1), ImVec2(Max.x, Max.y + 1), false);

        window->DrawList->AddRectFilledMultiColor(Min, Max, color_grayblue, color_grayblue, color_deepblue, color_deepblue); // Main gradient.

        ImVec2 mouse_pos = GetMousePos();
        bool mouse_click = g->IO.MouseClicked[0];

        float TabSize = ceil((Max.x - Min.x) / item_count);

        for (int32_t i = 0; i < item_count; i++)
        {
            ImVec2 Min_cur_label = ImVec2(Min.x + (int)TabSize * i, Min.y);
            ImVec2 Max_cur_label = ImVec2(Min.x + (int)TabSize * i + (int)TabSize, Max.y);

            // Imprecision clamping. gay but works :^)
            Max_cur_label.x = (Max_cur_label.x >= Max.x ? Max.x : Max_cur_label.x);

            if (mouse_pos.x > Min_cur_label.x && mouse_pos.x < Max_cur_label.x &&
                mouse_pos.y > Min_cur_label.y && mouse_pos.y < Max_cur_label.y)
            {
                if (mouse_click)
                    *selected = i;
                else if (i != *selected)
                    window->DrawList->AddRectFilled(Min_cur_label, Max_cur_label, color_shade_hover);
            }

            if (i == *selected) {
                window->DrawList->AddRectFilled(Min_cur_label, Max_cur_label, color_shade_clicked);
                window->DrawList->AddRectFilledMultiColor(Min_cur_label, Max_cur_label, color_deepblue, color_deepblue, color_grayblue, color_grayblue);
                window->DrawList->AddLine(ImVec2(Min_cur_label.x - 1.5f, Min_cur_label.y - 1), ImVec2(Max_cur_label.x - 0.5f, Min_cur_label.y - 1), color_black_outlines);
            }
            else
                window->DrawList->AddLine(ImVec2(Min_cur_label.x - 1, Min_cur_label.y), ImVec2(Max_cur_label.x, Min_cur_label.y), color_black_outlines);
            window->DrawList->AddLine(ImVec2(Max_cur_label.x - 1, Max_cur_label.y), ImVec2(Max_cur_label.x - 1, Min_cur_label.y - 0.5f), color_black_outlines);

            const ImVec2 text_size = CalcTextSize(items[i], NULL, true);
            float pad_ = style.FramePadding.x + g->FontSize + style.ItemInnerSpacing.x;
            ImRect tab_rect(Min_cur_label, Max_cur_label);
            RenderTextClipped(Min_cur_label, Max_cur_label, items[i], NULL, &text_size, style.WindowTitleAlign, &tab_rect);
        }

        window->DrawList->AddLine(ImVec2(Min.x, Min.y - 0.5f), ImVec2(Min.x, Max.y), color_black_outlines);
        window->DrawList->AddLine(ImVec2(Min.x, Max.y), Max, color_black_outlines);
        PopClipRect();
    }
Не забудтe прописать ImGui::End();
А да, кстати, Вместо Текста в табах можно поставить ВСЁЁЁЁ ЧТО УГОДНО(даже фотку своего ху** кхмм)
Я конечно всё понимаю, но нахуя эта тема я не понимаю...На форуме и так полно гайдов по имгую,да и с 0 писать на имгуе смысла НЕТ так как менюшек на нём херова туча,просто чуть чуть подправить и усё.Ну а люди которые абсолютно не шарят в этом,этим гайдом не воспользуются.:kissingheart:
 
гений мыслей, отец русской демократии
 
Салам колекам, сегодня я скажу как сделать табы для меню вашей пасты(высококачественного самописа).
Код:
Expand Collapse Copy
static int selected_Tab = 0;
static const char* items[3] = { "1", "2", "3" };
В скобках "", вмест0 1, 2, 3, вписать названия табов
Код:
Expand Collapse Copy
ImGui::SelectTabs(&selected_Tab, items, 3);
                switch (selected_Tab) {
                case 0:
                    ImGui::Text(u8"POSHEL");
                    break;
                case 1:
                    ImGui::Text(u8"NAHUY");
                    break;
                case 2:
                    ImGui::Text(u8"PIDORAS");
                    break;
                }
Код:
Expand Collapse Copy
void SelectTabs(int *selected, const char* items[], int item_count, ImVec2 size = ImVec2(0, 0))
    {
        auto color_grayblue = GetColorU32(ImVec4(0.35, 0.2, 0.2, 0.30));
        auto color_deepblue = GetColorU32(ImVec4(0.15, 0.1, 0.1, 0.30));
        auto color_shade_hover = GetColorU32(ImVec4(1, 1, 1, 0.05));
        auto color_shade_clicked = GetColorU32(ImVec4(0.8, 0.8, 1, 0.1));
        auto color_black_outlines = GetColorU32(ImVec4(0.05, 0, 0, 0.8));

        ImGuiStyle &style = GetStyle();
        ImGuiWindow* window = GetCurrentWindow();
        if (window->SkipItems)
            return;

        std::string names;
        for (int32_t i = 0; i < item_count; i++)
            names += items[i];

        ImGuiContext* g = GImGui;
        const ImGuiID id = window->GetID(names.c_str());
        const ImVec2 label_size = CalcTextSize(names.c_str(), NULL, true);

        ImVec2 Min = window->DC.CursorPos;
        ImVec2 Max = ((size.x <= 0 || size.y <= 0) ? ImVec2(Min.x + GetContentRegionMax().x - style.WindowPadding.x, Min.y + label_size.y * 2) : Min + size);

        ImRect bb(Min, Max);
        ItemSize(bb, style.FramePadding.y);
        if (!ItemAdd(bb, id))
            return;

        PushClipRect(ImVec2(Min.x, Min.y - 1), ImVec2(Max.x, Max.y + 1), false);

        window->DrawList->AddRectFilledMultiColor(Min, Max, color_grayblue, color_grayblue, color_deepblue, color_deepblue); // Main gradient.

        ImVec2 mouse_pos = GetMousePos();
        bool mouse_click = g->IO.MouseClicked[0];

        float TabSize = ceil((Max.x - Min.x) / item_count);

        for (int32_t i = 0; i < item_count; i++)
        {
            ImVec2 Min_cur_label = ImVec2(Min.x + (int)TabSize * i, Min.y);
            ImVec2 Max_cur_label = ImVec2(Min.x + (int)TabSize * i + (int)TabSize, Max.y);

            // Imprecision clamping. gay but works :^)
            Max_cur_label.x = (Max_cur_label.x >= Max.x ? Max.x : Max_cur_label.x);

            if (mouse_pos.x > Min_cur_label.x && mouse_pos.x < Max_cur_label.x &&
                mouse_pos.y > Min_cur_label.y && mouse_pos.y < Max_cur_label.y)
            {
                if (mouse_click)
                    *selected = i;
                else if (i != *selected)
                    window->DrawList->AddRectFilled(Min_cur_label, Max_cur_label, color_shade_hover);
            }

            if (i == *selected) {
                window->DrawList->AddRectFilled(Min_cur_label, Max_cur_label, color_shade_clicked);
                window->DrawList->AddRectFilledMultiColor(Min_cur_label, Max_cur_label, color_deepblue, color_deepblue, color_grayblue, color_grayblue);
                window->DrawList->AddLine(ImVec2(Min_cur_label.x - 1.5f, Min_cur_label.y - 1), ImVec2(Max_cur_label.x - 0.5f, Min_cur_label.y - 1), color_black_outlines);
            }
            else
                window->DrawList->AddLine(ImVec2(Min_cur_label.x - 1, Min_cur_label.y), ImVec2(Max_cur_label.x, Min_cur_label.y), color_black_outlines);
            window->DrawList->AddLine(ImVec2(Max_cur_label.x - 1, Max_cur_label.y), ImVec2(Max_cur_label.x - 1, Min_cur_label.y - 0.5f), color_black_outlines);

            const ImVec2 text_size = CalcTextSize(items[i], NULL, true);
            float pad_ = style.FramePadding.x + g->FontSize + style.ItemInnerSpacing.x;
            ImRect tab_rect(Min_cur_label, Max_cur_label);
            RenderTextClipped(Min_cur_label, Max_cur_label, items[i], NULL, &text_size, style.WindowTitleAlign, &tab_rect);
        }

        window->DrawList->AddLine(ImVec2(Min.x, Min.y - 0.5f), ImVec2(Min.x, Max.y), color_black_outlines);
        window->DrawList->AddLine(ImVec2(Min.x, Max.y), Max, color_black_outlines);
        PopClipRect();
    }
Не забудтe прописать ImGui::End();
А да, кстати, Вместо Текста в табах можно поставить ВСЁЁЁЁ ЧТО УГОДНО(даже фотку своего ху** кхмм)
Нормас, ток сс....
 
дружочек, ты видимо не понял с кем общаешься, вот твоя манера речи "клоунская" меня не впечатляет, давай с тобой встретимся и я тебе объясню на нормальном языке, языке боли
1585323586650.png
 
Обычные селект-табс GladiatorzCheatsV2.1
Выглядит неплохо
1585340287832.png
 
Same thing could have been done with imgui::button() but ok
 
Зачем u8 перед английским тестом?
 
Зачем u8 перед английским тестом?
Но коль уж апнул, то это кодировка для русского текста, работает, если использовать шрифт поддерживающий русскую раскладку.
 
Назад
Сверху Снизу