Вопрос Проблема с шрифтом

Участник
Статус
Оффлайн
Регистрация
19 Апр 2020
Сообщения
1,169
Реакции[?]
313
Поинты[?]
151K
когда меню открыта
1629801784459.png
а это когда закрыта
1629801797785.png
Код:
void c_menu::keys()
{
    if (!g_cfg.esp.keybinds)
        return;
    int pressed_binds = 0;
    int texts = 0;
    int modes = 0;
    std::string text = "";
    std::string mode = "";
    static bool other_bind_pressed = false;
    if (g_cfg.ragebot.double_tap && g_cfg.ragebot.double_tap_key.key > KEY_NONE && g_cfg.ragebot.double_tap_key.key < KEY_MAX && misc::get().double_tap_key) {
        text += "Doubletap";
        text += "\n";
        texts++;
        if(!misc::get().recharging_double_tap)
            mode += "[Charging..]  ";
        else
            mode += "[Charged]  ";//idk
        mode += "\n";
        modes++;
        pressed_binds++;
    }
    if (misc::get().hide_shots_key) {
        text += "Hideshots";
        text += "\n";
        texts++;
        mode += "[ON]  ";
        mode += "\n";
        modes++;
        pressed_binds++;
    }
    if (key_binds::get().get_key_bind_state(4 + g_ctx.globals.current_weapon)) {
        text += "Min DMG";
        text += "\n";
        texts++;
        mode += "[ON]  ";
        modes++;
        mode += "\n";
        pressed_binds++;
    }
    if (key_binds::get().get_key_bind_state(3)) {
        text += "Safepont";
        text += "\n";
        texts++;
        mode += "[ON]  ";
        modes++;
        mode += "\n";
        pressed_binds++;
    }
    if (key_binds::get().get_key_bind_state(22)) {
        text += "Body aim";
        text += "\n";
        texts++;
        mode += "[ON]  ";
        modes++;
        mode += "\n";
        pressed_binds++;
    }
    if (key_binds::get().get_key_bind_state(18)) {
        text += "AutoPeek";
        text += "\n";
        texts++;
        mode += "[ON]  ";
        mode += "\n";
        modes++;
        pressed_binds++;
    }
    if (key_binds::get().get_key_bind_state(20)) {
        text += "Fakeduck";
        text += "\n";
        texts++;
        mode += "[ON]  ";
        mode += "\n";
        modes++;
        pressed_binds++;
    }

    if (pressed_binds > 0 || hooks::menu_open)
        other_bind_pressed = true;
    else
        other_bind_pressed = false;

    ImVec2 Pos;
    ImVec2 size_menu;
    static float alpha_menu = 0.1f;

    if (other_bind_pressed)
    {
        if (alpha_menu < 1.f)
            alpha_menu += 0.05f;

    }
    else
    {
        if (alpha_menu > 0.1f)
            alpha_menu -= 0.05f;

    }



    if (g_cfg.esp.keybinds) {
        if ((other_bind_pressed && alpha_menu > 0.1f) || hooks::menu_open) {
            ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha_menu);
            if (ImGui::Begin("Keybinds", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar))
            {
                size_menu = ImGui::GetWindowSize();
                Pos = ImGui::GetWindowPos();
                auto Render = ImGui::GetWindowDrawList();
                Render->AddRectFilled({ Pos.x, Pos.y + 20 }, { Pos.x + size_menu.x, Pos.y + size_menu.y - 10 }, ImColor(35, 36, 46, ((int)(alpha_menu * 55))));
                Render->AddRectFilled({ Pos.x, Pos.y + 2 }, { Pos.x + size_menu.x, Pos.y + 20 }, ImColor(35, 36, 46, (int)(alpha_menu * 150)));
                Render->AddRectFilled({ Pos.x, Pos.y + 20 - 2 }, { Pos.x + size_menu.x, Pos.y + 20 }, ImColor(g_cfg.esp.Menucolor.r(), g_cfg.esp.Menucolor.g(), g_cfg.esp.Menucolor.b(), (int)(alpha_menu * 255)));
                ImVec2 size_text = ImGui::CalcTextSize(" key");
                ImVec2 size_texts = ImGui::CalcTextSize("key");
                ImGui::SetCursorPos({ (200 / 2) - size_text.x ,  5 });
                ImGui::TextColored(ImVec4(1.f, 1.f, 1.f, alpha_menu), "key");
                ImGui::SetCursorPos({ (200 / 2) - size_text.x + size_texts.x,  5 });
                ImGui::TextColored(ImVec4(g_cfg.esp.Menucolor.r() / 255.f, g_cfg.esp.Menucolor.g() / 255.f, g_cfg.esp.Menucolor.b() / 255.f, (alpha_menu)), "bind");
                if (texts > 0) text += "\n";
                if (modes > 0) mode += "\n";
                ImVec2 size = ImGui::CalcTextSize(text.c_str());
                ImVec2 size2 = ImGui::CalcTextSize(mode.c_str());
                ImGui::SetWindowSize(ImVec2(200, 20 + size.y));
                ImGui::SetCursorPosY(21);
                ImGui::Columns(2, "fart1", false);


                ImGui::SetColumnWidth(0, 200 - (size2.x + 8));
                ImGui::TextColored(ImVec4(1.f, 1.f, 1.f, alpha_menu), text.c_str());
                ImGui::NextColumn();

                ImGui::TextColored(ImVec4(1.f, 1.f, 1.f, alpha_menu), mode.c_str());
                ImGui::Columns(1);
                // ImGui::Separator();

            }
            ImGui::End();
            ImGui::PopStyleVar();
            //    }
        }
    }


}
 
Пользователь
Статус
Онлайн
Регистрация
22 Июн 2020
Сообщения
183
Реакции[?]
69
Поинты[?]
41K
ты это делаешь через апи имгуя для менюшки (он автоматом ставит шрифт) а лучше делать просто через рендер

решается проблема с помощью PushFont(нужный шрифт)
после рендера PopFont
 
Сверху Снизу