Вопрос Спектатор лист о_О

Участник
Статус
Оффлайн
Регистрация
22 Дек 2018
Сообщения
617
Реакции[?]
182
Поинты[?]
12K
визуал.спп
Код:
void Visuals::RenderSpectatorList() {
    int specs = 0;
    std::string spect = "";

    if (g_EngineClient->IsInGame() && g_EngineClient->IsConnected() && g_LocalPlayer) {
        C_BasePlayer* pLocalEntity;
        if (!g_LocalPlayer->IsAlive() && g_LocalPlayer->m_hObserverTarget().IsValid() && g_LocalPlayer->m_hObserverTarget().Get())
            pLocalEntity = g_LocalPlayer->m_hObserverTarget().Get();
        else
            pLocalEntity = g_LocalPlayer;

        if (pLocalEntity) {
            for (int i = 0; i < g_EngineClient->GetMaxClients(); i++) {
                C_BasePlayer* pBaseEntity = C_BasePlayer::GetPlayerByIndex(i);
                if (!pBaseEntity)                                             continue;
                if (pBaseEntity->m_iHealth() > 0)                             continue;
                if (pBaseEntity == pLocalEntity)                             continue;
                if (pBaseEntity->IsDormant())                                 continue;
                if (pBaseEntity->m_hObserverTarget() != pLocalEntity)         continue;
                player_info_t pInfo;
                g_EngineClient->GetPlayerInfo(pBaseEntity->EntIndex(), &pInfo);
                if (pInfo.ishltv) continue;

                spect += pInfo.szName;
                spect += "\n";
            }
        }
    }

    
        
    if (g_Options.misc_spectatorlist) {


        ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.5f, 0.5f));
        if (ImGui::Begin("Spectator list", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoTitleBar)) {


            ImVec2 size = ImGui::CalcTextSize(spect.c_str());
            ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(ImGui::GetWindowPos()), ImVec2(ImGui::GetWindowPos().x + 200, ImGui::GetWindowPos().y + (size.y) * 4), ImColor(0, 0, 0));
            ImGui::SetCursorPos({ 75.f,3.f });

            ImGui::PushFont(g_Visuals2Font);
            ImGui::Text("Spectators", 15.f);
            ImGui::PopFont();


            ImGui::SetWindowSize(ImVec2(200,size.y - 20));

            ImGui::Spacing();
            ImGui::PushFont(g_Visuals3Font);
            ImGui::Text(spect.c_str(), g_Visuals3Font);
            ImGui::PopFont();
            
                auto pos = ImGui::GetWindowPos();
                ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(pos.x + 0, size.y + 5), ImVec2(pos.x + 200, size.y + 8), ImColor(100, 100, 255, 255), 1.f, 15);
            
        }
        
        
        ImGui::End();
        ImGui::PopStyleVar();
    }
}
имгуи.спп
Код:
ImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width)
{
    ImGuiContext& g = *GImGui;

    const char* text_display_end;
    if (hide_text_after_double_hash)
        text_display_end = FindRenderedTextEnd(text, text_end);      // Hide anything after a '##' string
    else
        text_display_end = text_end;

    ImFont* font = g.Font;
    const float font_size = g.FontSize;
    if (text == text_display_end)
        return ImVec2(0.0f, font_size);
    ImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);

    // Round
    text_size.x = IM_FLOOR(text_size.x + 0.95f);

    return text_size;
}
1622749614057.pngВот карочи а надо чтобы текст побольш был
я и шрифт больше меньше делал, и значение CalcTextSize, незнаю я помогите
 
Участник
Статус
Оффлайн
Регистрация
22 Дек 2018
Сообщения
617
Реакции[?]
182
Поинты[?]
12K
[QUOTE="two, post: 2200146, member: 226617"
менял? и ещё дай
g_Visuals3Font
[/QUOTE]
Я тестил хоть с, хоть без, не меняет ничего
 
Эксперт
Статус
Оффлайн
Регистрация
7 Сен 2019
Сообщения
2,107
Реакции[?]
984
Поинты[?]
88K
Участник
Статус
Оффлайн
Регистрация
22 Дек 2018
Сообщения
617
Реакции[?]
182
Поинты[?]
12K
Эксперт
Статус
Оффлайн
Регистрация
7 Сен 2019
Сообщения
2,107
Реакции[?]
984
Поинты[?]
88K
Бля, не видел о_О попробую

Попробуй вместо Visuals3Font сделать
ImGui::PushFont(g_Visuals2Font);
А это уже другой у меня шрифт о_О
[/QUOTE]
скинь мне именно Visuals3Font этот шрифт
 
Участник
Статус
Оффлайн
Регистрация
22 Дек 2018
Сообщения
617
Реакции[?]
182
Поинты[?]
12K
Участник
Статус
Оффлайн
Регистрация
22 Дек 2018
Сообщения
617
Реакции[?]
182
Поинты[?]
12K
AddFontFromFileTTF(u8"C:\\Windows\\Fonts\\Verdana.ttf", 15.f, NULL, io.Fonts->GetGlyphRangesCyrillic())
Можешь ещё дать Visuals2font?
[/QUOTE]
AddFontFromFileTTF(u8"C:\\Windows\\Fonts\\Verdanab.ttf", 30.f, NULL, io.Fonts->GetGlyphRangesCyrillic())
 
Эксперт
Статус
Оффлайн
Регистрация
7 Сен 2019
Сообщения
2,107
Реакции[?]
984
Поинты[?]
88K
Можешь ещё дать Visuals2font?
AddFontFromFileTTF(u8"C:\\Windows\\Fonts\\Verdanab.ttf", 30.f, NULL, io.Fonts->GetGlyphRangesCyrillic())
[/QUOTE]

AddFontFromFileTTF(u8"C:\\Windows\\Fonts\\Verdana.ttf", 25.f, NULL, io.Fonts->GetGlyphRangesCyrillic())
проверяй так тогда



и пж не лайкай так много меня, админы или модеры посчитают за накрутку, сними 4 лайка
 
Сверху Снизу