Вопрос Спек лист

Начинающий
Статус
Оффлайн
Регистрация
29 Дек 2021
Сообщения
7
Реакции[?]
0
Поинты[?]
0
C++:
void Menu::SpectatorList() {
    int specs = 0;
    std::string spect = "";

    if (g_EngineClient->IsInGame() && g_EngineClient->IsConnected()) {
        int localIndex = g_EngineClient->GetLocalPlayer();
        C_BasePlayer* pLocalEntity = C_BasePlayer::GetPlayerByIndex(localIndex);
        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";
                specs++;
            }
        }
    }
    if (!g_Options.spectator_list)
        return;

    ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2());
    ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.f, 0.f, 0.f, 1.f));
    static auto flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
    if (ImGui::Begin("Spectator List", nullptr, ImVec2(), 1.0f, flags)) {
        
        ImGui::PushFont(g_pSecondFont);
        if (ImGui::BeginChild("Child1", ImVec2(), false, flags)) {
            ImVec2 p = ImGui::GetCursorScreenPos();
            ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(p.x, p.y + 3), ImVec2(p.x + ImGui::GetWindowWidth(), p.y + -3), ImColor(0, 0, 255));
            ImGui::GetWindowDrawList()->AddRectFilledMultiColor(ImVec2(p.x, p.y + 3), ImVec2(p.x + ImGui::GetWindowWidth() / 2, p.y + -3), ImColor(g_Options.vis_accentcol2), ImColor(g_Options.vis_accentcol2), ImColor(g_Options.vis_accentcol2), ImColor(g_Options.vis_accentcol2));
            ImGui::GetWindowDrawList()->AddRectFilledMultiColor(ImVec2(p.x + ImGui::GetWindowWidth() / 2, p.y + 3), ImVec2(p.x + ImGui::GetWindowWidth(), p.y + -3), ImColor(g_Options.vis_accentcol2), ImColor(g_Options.vis_accentcol2), ImColor(g_Options.vis_accentcol2), ImColor(g_Options.vis_accentcol2));
            ImGui::GetWindowDrawList()->AddLine(ImVec2(p.x, p.y + 2), ImVec2(p.x + ImGui::GetWindowWidth(), p.y + 2), ImColor(0, 0, 0, 150));

            ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 4);

            ImGui::SetCursorPosX((ImGui::GetWindowWidth() - ImGui::CalcTextSize("spectator list::").x) / 4);
            ImGui::Text("  spectators  ", 24.f);
        }
        ImGui::EndChild();

        if (specs > 0) spect += "\n";

        ImVec2 size = ImGui::CalcTextSize(spect.c_str());

        ImGui::SetWindowSize(ImVec2(100, 40));

        

        if (ImGui::BeginChild("Child2", ImVec2(), false, flags))
            ImGui::TextColored(ImColor(255, 255, 255), spect.c_str());

        ImGui::EndChild();
        ImGui::PopFont();
    }
    ImGui::End();

    ImGui::PopStyleColor();
}
короч ебанул на симпл спек лист все вроде норм но есть одна проблема
когда делаю свою позицию спека при альт табе спек улетает в ебеня
 
ставь чайник, зажигай плиту
Эксперт
Статус
Оффлайн
Регистрация
22 Май 2020
Сообщения
1,444
Реакции[?]
1,092
Поинты[?]
10K
Обнови имгуи, это вроде фиксили когда-то давно
 
Сверху Снизу