葫芦娃
Ir al canal en Telegram
This Channel follows Telegram Terms. No adult content, no violence, no spam.
Mostrar más2 948
Suscriptores
Sin datos24 horas
+47 días
+1930 días
Archivo de publicaciones
2 948
// --- 3. [头顶昵称与队号:分段色块模式] ---
if (定义.昵称) {
std::string nameStr = data.Player->PlayerName.ToString();
std::string teamStr = (定义.队伍) ? std::to_string(tid) : "";
// 精确计算各部分宽度
float teamW = (定义.队伍) ? ImGui::CalcTextSize2(teamStr.c_str(), 0, 当前字号).x + 12.0f * scale : 0;
float nameW = ImGui::CalcTextSize2(nameStr.c_str(), 0, 当前字号).x + 10.0f * scale;
float totalW = teamW + nameW;
// 起始绘制位置 (水平居中)
ImVec2 nPos = {data.headPosSC.x - totalW / 2, t - nOffset - 26 * scale};
float currentX = nPos.x;
// A. 绘制左侧:队号彩色色块
if (定义.队伍) {
// 彩色背景 (左侧带小圆角)
draw->AddRectFilled({currentX, nPos.y}, {currentX + teamW, nPos.y + 22 * scale}, 队号背景色, 2.0f);
// 队号文字 (固定纯白,对比度最高)
ImVec2 tSize = ImGui::CalcTextSize2(teamStr.c_str(), 0, 当前字号);
ImVec2 tPos = {currentX + (teamW - tSize.x) / 2, nPos.y + (22 * scale - tSize.y) / 2};
draw->AddText(NULL, 当前字号, tPos, IM_COL32(255, 255, 255, 255), teamStr.c_str());
currentX += teamW; // 移动坐标,准备画昵称
}
draw->AddRectFilled({currentX, nPos.y}, {currentX + nameW, nPos.y + 22 * scale}, IM_COL32(0, 0, 0, 100), 2.0f);
// 昵称文字 (明黄)
ImVec2 nSize = ImGui::CalcTextSize2(nameStr.c_str(), 0, 当前字号);
ImVec2 nTextPos = {currentX + (nameW - nSize.x) / 2, nPos.y + (22 * scale - nSize.y) / 2};
// 黑色阴影
draw->AddText(NULL, 当前字号, {nTextPos.x + 1, nTextPos.y + 1}, IM_COL32(0, 0, 0, 200), nameStr.c_str());
// 主色文字
draw->AddText(NULL, 当前字号, nTextPos, IM_COL32(255, 255, 0, 255), nameStr.c_str());
}
