ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
58.85k stars 10.05k forks source link

Menu tabs spacing #1606

Closed DGRuben closed 6 years ago

DGRuben commented 6 years ago

I wan't to fill up this spacing for the tabs but if I make them bigger it won't change the spaces http://prntscr.com/icq5kv

Code: ` constexpr static float get_sidebar_item_width() { return 300.0f; } constexpr static float get_sidebar_item_height() { return 40.0f; }

template<size_t N>
void render_tabs(char* (&names)[N], int& activetab, float w, float h, bool sameline)
{
    bool values[N] = { false };

    values[activetab] = true;

    for (auto i = 0; i < N; ++i) {
        if (ImGui::ToggleButton(names[i], &values[i], ImVec2{ w, h })) {
            activetab = i;
        }
        if (sameline && i < N - 1)
            ImGui::SameLine();
    }
}

void OnRenderGUI()
{
    Color MenuBackGround = Color(int(Settings::Misc::MenuBackGround[0] * 255.f),
        int(Settings::Misc::MenuBackGround[1] * 255.f),
        int(Settings::Misc::MenuBackGround[2] * 255.f),
        int(Settings::Misc::MenuBackGround[3] * 255.f));

    g_pRender->DrawFillBox(0, 0, iScreenWidth, iScreenHeight, MenuBackGround);

    CLicense lic;
    ImVec2 YouGameComWindowsMain;
    static int tabOrder[] = { 0 , 1 , 2 , 3 , 4 };
    static int tabSelected = 0;

    //static string username = lic.GetUserLogin();

    ImGui::SetNextWindowSize(ImVec2(195, 450));

    if (ImGui::Begin("#Merc", &bIsGuiVisible, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_ShowBorders))
    {
        ImGui::PushFont(MiddleFont);

        YouGameComWindowsMain = ImGui::GetWindowPos();

        if (Settings::Aimbot::weapon_aim_settings[iWeaponID].aim_FovType > 1)
            Settings::Aimbot::weapon_aim_settings[iWeaponID].aim_FovType = 1;

        if (Settings::Aimbot::weapon_aim_settings[iWeaponID].aim_BestHit > 1)
            Settings::Aimbot::weapon_aim_settings[iWeaponID].aim_BestHit = 1;

        if (Settings::Aimbot::weapon_aim_settings[iWeaponID].aim_Spot > 14)
            Settings::Aimbot::weapon_aim_settings[iWeaponID].aim_Spot = 14;

        static char* tabNames[] = {
            "Aimbot" , "Visuals" , "Skinchanger" ,
            "Misc" , "Colors" };
        render_tabs(tabNames, tabSelected, get_sidebar_item_width(), get_sidebar_item_height(), false);

        ImGui::PopFont();

        ImGui::End();
    }`
ocornut commented 6 years ago

Sorry but #1586

DGRuben commented 6 years ago

LUL