mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Append rect width
This commit is contained in:
parent
b285a3d96d
commit
c19c60012c
|
@ -715,6 +715,7 @@ void CChat::OnRender()
|
|||
// FIXME: sometimes an empty line will pop here when the cursor reaches the end of line
|
||||
Line.m_Size[OffsetType].y = Cursor.m_LineCount * Cursor.m_FontSize;
|
||||
Line.m_Size[OffsetType].x = Cursor.m_LineCount == 1 ? Cursor.m_X - Cursor.m_StartX : LineWidth;
|
||||
Line.m_Size[OffsetType].x += RenderTools()->GetClientIdRectSize(Cursor.m_FontSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ void CHud::RenderScoreHud()
|
|||
int ID = FlagCarrier[t]%MAX_CLIENTS;
|
||||
char aName[64];
|
||||
str_format(aName, sizeof(aName), "%s", g_Config.m_ClShowsocial ? m_pClient->m_aClients[ID].m_aName : "");
|
||||
float w = TextRender()->TextWidth(0, 8.0f, aName, -1);
|
||||
float w = TextRender()->TextWidth(0, 8.0f, aName, -1) + RenderTools()->GetClientIdRectSize(8.0f);
|
||||
|
||||
CTextCursor Cursor;
|
||||
float x = min(Whole-w-1.0f, Whole-ScoreWidthMax-ImageSize-2*Split);
|
||||
|
|
|
@ -59,8 +59,8 @@ void CKillMessages::OnRender()
|
|||
continue;
|
||||
|
||||
float FontSize = 36.0f;
|
||||
float KillerNameW = TextRender()->TextWidth(0, FontSize, m_aKillmsgs[r].m_aKillerName, -1);
|
||||
float VictimNameW = TextRender()->TextWidth(0, FontSize, m_aKillmsgs[r].m_aVictimName, -1);
|
||||
float KillerNameW = TextRender()->TextWidth(0, FontSize, m_aKillmsgs[r].m_aKillerName, -1) + RenderTools()->GetClientIdRectSize(FontSize);
|
||||
float VictimNameW = TextRender()->TextWidth(0, FontSize, m_aKillmsgs[r].m_aVictimName, -1) + RenderTools()->GetClientIdRectSize(FontSize);
|
||||
|
||||
float x = StartX;
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ void CNamePlates::RenderNameplate(
|
|||
|
||||
char aName[64];
|
||||
str_format(aName, sizeof(aName), "%s", g_Config.m_ClShowsocial ? m_pClient->m_aClients[ClientID].m_aName: "");
|
||||
float tw = TextRender()->TextWidth(0, FontSize, aName, -1);
|
||||
|
||||
CTextCursor Cursor;
|
||||
float tw = TextRender()->TextWidth(0, FontSize, aName, -1) + RenderTools()->GetClientIdRectSize(FontSize);
|
||||
TextRender()->SetCursor(&Cursor, Position.x-tw/2.0f, Position.y-FontSize-38.0f, FontSize, TEXTFLAG_RENDER);
|
||||
|
||||
TextRender()->TextOutlineColor(0.0f, 0.0f, 0.0f, 0.5f*a);
|
||||
|
|
|
@ -624,3 +624,8 @@ void CRenderTools::DrawClientID(ITextRender* pTextRender, CTextCursor* pCursor,
|
|||
|
||||
pCursor->m_X = PrevX + Rect.w + 0.2f * FontSize;
|
||||
}
|
||||
|
||||
float CRenderTools::GetClientIdRectSize(float FontSize)
|
||||
{
|
||||
return 1.4f * FontSize + 0.2f * FontSize;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
|
||||
void DrawClientID(ITextRender* pTextRender, CTextCursor* pCursor, int ID,
|
||||
const vec4& BgColor = vec4(1, 1, 1, 0.5f), const vec4& TextColor = vec4(0.1f, 0.1f, 0.1f, 1.0f));
|
||||
|
||||
float GetClientIdRectSize(float FontSize);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue