XG 资源分享
رفتن به کانال در Telegram
اطلاعاتی وجود ندارد
مشترکین
+124 ساعت
+467 روز
+7930 روز
آرشیو پست ها
if (人数) {
ImDrawList* draw = ImGui::GetForegroundDrawList();
ImVec2 screenSize = ImGui::GetIO().DisplaySize;
int total = g_TotalEnemies + g_TotalBots;
float baseH = 50.f; // 高度+10
float panelY = screenSize.y * 0.025f;
// 有人110,无人90
float targetW = (total > 0) ? 110.f : 90.f;
static float currentW = 90.f;
currentW += (targetW - currentW) * 0.15f;
if (fabs(currentW - targetW) < 0.5f) currentW = targetW;
float panelW = currentW;
float panelH = baseH;
float roundRadius = panelH / 2.f;
ImVec2 panelMin = ImVec2((screenSize.x - panelW) / 2.f, panelY);
ImVec2 panelMax = ImVec2(panelMin.x + panelW, panelMin.y + panelH);
ImVec2 mouse = ImGui::GetIO().MousePos;
bool hover = (mouse.x >= panelMin.x && mouse.x <= panelMax.x &&
mouse.y >= panelMin.y && mouse.y <= panelMax.y);
draw->AddRectFilled(panelMin, panelMax, IM_COL32(15, 14, 20, 200), roundRadius);
draw->AddRect(panelMin, panelMax, IM_COL32(60, 50, 80, 130), roundRadius, 0, 1.2f);
float centerY = (panelMin.y + panelMax.y) / 2.f;
float centerX = (panelMin.x + panelMax.x) / 2.f;
if (total > 0) {
float splitX = panelMin.x + panelW * 0.5f;
draw->AddLine(
ImVec2(splitX, panelMin.y + 8),
ImVec2(splitX, panelMax.y - 8),
IM_COL32(80, 70, 100, 100), 1.f
);
char plyText[32];
sprintf(plyText, "%d", g_TotalEnemies);
draw->AddText(ImGui::GetFont(), 24.f, // 字体变大
ImVec2(panelMin.x + 16, centerY - 14),
IM_COL32(255, 100, 100, 255), plyText);
char botText[32];
sprintf(botText, "%d", g_TotalBots);
draw->AddText(ImGui::GetFont(), 24.f, // 字体变大
ImVec2(panelMin.x + panelW - 16 - ImGui::CalcTextSize(botText).x, centerY - 14),
IM_COL32(100, 255, 150, 255), botText);
} else {
draw->AddText(ImGui::GetFont(), 24.f,
ImVec2(centerX - ImGui::CalcTextSize("SAFE").x / 2, centerY - 14),
IM_COL32(100, 255, 150, 230), "SAFE");
}
if (hover && ImGui::IsMouseClicked(0)) {
悬浮窗 = !悬浮窗;
}
}if (人数) {
ImDrawList* draw = ImGui::GetForegroundDrawList();
ImVec2 screenSize = ImGui::GetIO().DisplaySize;
int total = g_TotalEnemies + g_TotalBots;
float baseH = 50.f; // 高度+10
float panelY = screenSize.y * 0.025f;
// 有人110,无人90
float targetW = (total > 0) ? 110.f : 90.f;
static float currentW = 90.f;
currentW += (targetW - currentW) * 0.15f;
if (fabs(currentW - targetW) < 0.5f) currentW = targetW;
float panelW = currentW;
float panelH = baseH;
float roundRadius = panelH / 2.f;
ImVec2 panelMin = ImVec2((screenSize.x - panelW) / 2.f, panelY);
ImVec2 panelMax = ImVec2(panelMin.x + panelW, panelMin.y + panelH);
ImVec2 mouse = ImGui::GetIO().MousePos;
bool hover = (mouse.x >= panelMin.x && mouse.x <= panelMax.x &&
mouse.y >= panelMin.y && mouse.y <= panelMax.y);
draw->AddRectFilled(panelMin, panelMax, IM_COL32(15, 14, 20, 200), roundRadius);
draw->AddRect(panelMin, panelMax, IM_COL32(60, 50, 80, 130), roundRadius, 0, 1.2f);
float centerY = (panelMin.y + panelMax.y) / 2.f;
float centerX = (panelMin.x + panelMax.x) / 2.f;
if (total > 0) {
float splitX = panelMin.x + panelW * 0.5f;
draw->AddLine(
ImVec2(splitX, panelMin.y + 8),
ImVec2(splitX, panelMax.y - 8),
IM_COL32(80, 70, 100, 100), 1.f
);
char plyText[32];
sprintf(plyText, "%d", g_TotalEnemies);
draw->AddText(ImGui::GetFont(), 24.f, // 字体变大
ImVec2(panelMin.x + 16, centerY - 14),
IM_COL32(255, 100, 100, 255), plyText);
char botText[32];
sprintf(botText, "%d", g_TotalBots);
draw->AddText(ImGui::GetFont(), 24.f, // 字体变大
ImVec2(panelMin.x + panelW - 16 - ImGui::CalcTextSize(botText).x, centerY - 14),
IM_COL32(100, 255, 150, 255), botText);
} else {
draw->AddText(ImGui::GetFont(), 24.f,
ImVec2(centerX - ImGui::CalcTextSize("SAFE").x / 2, centerY - 14),
IM_COL32(100, 255, 150, 230), "SAFE");
}
if (hover && ImGui::IsMouseClicked(0)) {
悬浮窗 = !悬浮窗;
}
}