mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-05 15:48:19 +00:00
Backported fix for TextWidth() parameter mix-up
Fixes #2511 (Stack-buffer-overflows in some UIs). The original fix was done by @oy for 0.7.4.
This commit is contained in:
parent
c6ec6c5e50
commit
b1c17c3248
|
@ -745,11 +745,12 @@ public:
|
|||
TextEx(&Cursor, pText, -1);
|
||||
}
|
||||
|
||||
virtual float TextWidth(void *pFontSetV, float Size, const char *pText, int Length, float *pAlignedHeight = NULL)
|
||||
virtual float TextWidth(void *pFontSetV, float Size, const char *pText, int StrLength, float LineWidth, float *pAlignedHeight = NULL)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
SetCursor(&Cursor, 0, 0, Size, 0);
|
||||
TextEx(&Cursor, pText, Length);
|
||||
Cursor.m_LineWidth = LineWidth;
|
||||
TextEx(&Cursor, pText, StrLength);
|
||||
if(pAlignedHeight != NULL)
|
||||
*pAlignedHeight = Cursor.m_AlignedFontSize;
|
||||
return Cursor.m_X;
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
virtual void TextColor(ColorRGBA rgb) = 0;
|
||||
virtual void TextOutlineColor(float r, float g, float b, float a) = 0;
|
||||
virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, int MaxWidth) = 0;
|
||||
virtual float TextWidth(void *pFontSetV, float Size, const char *pText, int Length, float *pAlignedHeight = NULL) = 0;
|
||||
virtual float TextWidth(void *pFontSetV, float Size, const char *pText, int StrLength, float LineWidth, float *pAlignedHeight = NULL) = 0;
|
||||
virtual int TextLineCount(void *pFontSetV, float Size, const char *pText, float LineWidth) = 0;
|
||||
|
||||
virtual void OnWindowResize() = 0;
|
||||
|
|
|
@ -1020,7 +1020,7 @@ void CChat::OnRender()
|
|||
}
|
||||
|
||||
TextRender()->TextEx(&Cursor, m_Input.GetString(Editing)+m_ChatStringOffset, m_Input.GetCursorOffset(Editing)-m_ChatStringOffset);
|
||||
static float MarkerOffset = TextRender()->TextWidth(0, 8.0f, "|", -1)/3;
|
||||
static float MarkerOffset = TextRender()->TextWidth(0, 8.0f, "|", -1, -1.0f)/3;
|
||||
CTextCursor Marker = Cursor;
|
||||
Marker.m_X -= MarkerOffset;
|
||||
TextRender()->TextEx(&Marker, "|", -1);
|
||||
|
|
|
@ -404,7 +404,7 @@ void CGameConsole::PossibleCommandsRenderCallback(const char *pStr, void *pUser)
|
|||
|
||||
if(pInfo->m_EnumCount == pInfo->m_WantedCompletion)
|
||||
{
|
||||
float tw = pInfo->m_pSelf->TextRender()->TextWidth(pInfo->m_Cursor.m_pFont, pInfo->m_Cursor.m_FontSize, pStr, -1);
|
||||
float tw = pInfo->m_pSelf->TextRender()->TextWidth(pInfo->m_Cursor.m_pFont, pInfo->m_Cursor.m_FontSize, pStr, -1, -1.0f);
|
||||
pInfo->m_pSelf->Graphics()->TextureClear();
|
||||
pInfo->m_pSelf->Graphics()->QuadsBegin();
|
||||
pInfo->m_pSelf->Graphics()->SetColor(229.0f/255.0f,185.0f/255.0f,4.0f/255.0f,0.85f);
|
||||
|
@ -612,7 +612,7 @@ void CGameConsole::OnRender()
|
|||
Cursor.m_LineWidth = Screen.w - 10.0f - x;
|
||||
|
||||
TextRender()->TextEx(&Cursor, aInputString, pConsole->m_Input.GetCursorOffset(Editing));
|
||||
static float MarkerOffset = TextRender()->TextWidth(0, FontSize, "|", -1)/3;
|
||||
static float MarkerOffset = TextRender()->TextWidth(0, FontSize, "|", -1, -1.0f)/3;
|
||||
CTextCursor Marker = Cursor;
|
||||
Marker.m_X -= MarkerOffset;
|
||||
Marker.m_LineWidth = -1;
|
||||
|
@ -711,7 +711,7 @@ void CGameConsole::OnRender()
|
|||
|
||||
// render version
|
||||
str_format(aBuf, sizeof(aBuf), "v%s", GAME_VERSION);
|
||||
float Width = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
float Width = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, Screen.w-Width-10.0f, FontSize / 2.f, FontSize, aBuf, -1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,34 +43,34 @@ void CDebugHud::RenderNetCorrections()
|
|||
x = Width-10.0f;
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed/32);
|
||||
float w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
float w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
y += LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed/32*Ramp);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
y += LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", Ramp);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
y += 2*LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", static_cast<float>(m_pClient->m_Snap.m_pLocalCharacter->m_X)/32.0f);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
y += LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", static_cast<float>(m_pClient->m_Snap.m_pLocalCharacter->m_Y)/32.0f);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
y += LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_Snap.m_pLocalCharacter->m_Angle);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
y += 2*LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->NetobjNumCorrections());
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
y += LineHeight;
|
||||
w = TextRender()->TextWidth(0, Fontsize, m_pClient->NetobjCorrectedOn(), -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, m_pClient->NetobjCorrectedOn(), -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, m_pClient->NetobjCorrectedOn(), -1);
|
||||
}
|
||||
|
||||
|
@ -103,12 +103,12 @@ void CDebugHud::RenderTuning()
|
|||
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", Standard);
|
||||
x += 20.0f;
|
||||
w = TextRender()->TextWidth(0, 5, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, 5, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1);
|
||||
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", Current);
|
||||
x += 20.0f;
|
||||
w = TextRender()->TextWidth(0, 5, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, 5, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1);
|
||||
|
||||
x += 5.0f;
|
||||
|
|
|
@ -134,9 +134,9 @@ void CHud::RenderGameTimer()
|
|||
float FontSize = 10.0f;
|
||||
float w;
|
||||
if(g_Config.m_ClShowDecisecs)
|
||||
w = TextRender()->TextWidth(0, 12,"00:00.0",-1);
|
||||
w = TextRender()->TextWidth(0, 12, "00:00.0", -1, -1.0f);
|
||||
else
|
||||
w = TextRender()->TextWidth(0, 12,"00:00",-1);
|
||||
w = TextRender()->TextWidth(0, 12, "00:00", -1, -1.0f);
|
||||
// last 60 sec red, last 10 sec blink
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit && Time <= 60 && (m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer <= 0))
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ void CHud::RenderPauseNotification()
|
|||
{
|
||||
const char *pText = Localize("Game paused");
|
||||
float FontSize = 20.0f;
|
||||
float w = TextRender()->TextWidth(0, FontSize,pText, -1);
|
||||
float w = TextRender()->TextWidth(0, FontSize,pText, -1, -1.0f);
|
||||
TextRender()->Text(0, 150.0f*Graphics()->ScreenAspect()+-w/2.0f, 50.0f, FontSize, pText, -1);
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ void CHud::RenderSuddenDeath()
|
|||
float Half = 300.0f*Graphics()->ScreenAspect()/2.0f;
|
||||
const char *pText = Localize("Sudden Death");
|
||||
float FontSize = 12.0f;
|
||||
float w = TextRender()->TextWidth(0, FontSize, pText, -1);
|
||||
float w = TextRender()->TextWidth(0, FontSize, pText, -1, -1.0f);
|
||||
TextRender()->Text(0, Half-w/2, 2, FontSize, pText, -1);
|
||||
}
|
||||
}
|
||||
|
@ -202,13 +202,13 @@ void CHud::RenderScoreHud()
|
|||
{
|
||||
if(RecreateTeamScore[t])
|
||||
{
|
||||
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(0, 14.0f, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE], -1);
|
||||
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(0, 14.0f, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE], -1, -1.0f);
|
||||
mem_copy(m_aScoreInfo[t].m_aScoreText, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE], sizeof(m_aScoreInfo[t].m_aScoreText));
|
||||
RecreateRect = true;
|
||||
}
|
||||
}
|
||||
|
||||
static float s_TextWidth100 = TextRender()->TextWidth(0, 14.0f, "100", -1);
|
||||
static float s_TextWidth100 = TextRender()->TextWidth(0, 14.0f, "100", -1, -1.0f);
|
||||
float ScoreWidthMax = maximum(maximum(m_aScoreInfo[0].m_ScoreTextWidth, m_aScoreInfo[1].m_ScoreTextWidth), s_TextWidth100);
|
||||
float Split = 3.0f;
|
||||
float ImageSize = GameFlags & GAMEFLAG_FLAGS ? 16.0f : Split;
|
||||
|
@ -273,7 +273,7 @@ void CHud::RenderScoreHud()
|
|||
if(m_aScoreInfo[t].m_OptionalNameTextContainerIndex != -1)
|
||||
TextRender()->DeleteTextContainer(m_aScoreInfo[t].m_OptionalNameTextContainerIndex);
|
||||
|
||||
float w = TextRender()->TextWidth(0, 8.0f, pName, -1);
|
||||
float w = TextRender()->TextWidth(0, 8.0f, pName, -1, -1.0f);
|
||||
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, minimum(Whole - w - 1.0f, Whole - ScoreWidthMax - ImageSize - 2 * Split), StartY + (t + 1)*20.0f - 2.0f, 8.0f, TEXTFLAG_RENDER);
|
||||
|
@ -355,7 +355,7 @@ void CHud::RenderScoreHud()
|
|||
{
|
||||
if(RecreateScore[t])
|
||||
{
|
||||
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(0, 14.0f, aScore[t], -1);
|
||||
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(0, 14.0f, aScore[t], -1, -1.0f);
|
||||
mem_copy(m_aScoreInfo[t].m_aScoreText, aScore[t], sizeof(m_aScoreInfo[t].m_aScoreText));
|
||||
RecreateRect = true;
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ void CHud::RenderScoreHud()
|
|||
RecreateRect = true;
|
||||
}
|
||||
|
||||
static float s_TextWidth10 = TextRender()->TextWidth(0, 14.0f, "10", -1);
|
||||
static float s_TextWidth10 = TextRender()->TextWidth(0, 14.0f, "10", -1, -1.0f);
|
||||
float ScoreWidthMax = maximum(maximum(m_aScoreInfo[0].m_ScoreTextWidth, m_aScoreInfo[1].m_ScoreTextWidth), s_TextWidth10);
|
||||
float Split = 3.0f, ImageSize = 16.0f, PosSize = 16.0f;
|
||||
|
||||
|
@ -437,7 +437,7 @@ void CHud::RenderScoreHud()
|
|||
if(m_aScoreInfo[t].m_OptionalNameTextContainerIndex != -1)
|
||||
TextRender()->DeleteTextContainer(m_aScoreInfo[t].m_OptionalNameTextContainerIndex);
|
||||
|
||||
float w = TextRender()->TextWidth(0, 8.0f, pName, -1);
|
||||
float w = TextRender()->TextWidth(0, 8.0f, pName, -1, -1.0f);
|
||||
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, minimum(Whole - w - 1.0f, Whole - ScoreWidthMax - ImageSize - 2 * Split - PosSize), StartY + (t + 1)*20.0f - 2.0f, 8.0f, TEXTFLAG_RENDER);
|
||||
|
@ -499,7 +499,7 @@ void CHud::RenderWarmupTimer()
|
|||
{
|
||||
char Buf[256];
|
||||
float FontSize = 20.0f;
|
||||
float w = TextRender()->TextWidth(0, FontSize, Localize("Warmup"), -1);
|
||||
float w = TextRender()->TextWidth(0, FontSize, Localize("Warmup"), -1, -1.0f);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 50, FontSize, Localize("Warmup"), -1);
|
||||
|
||||
int Seconds = m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer/SERVER_TICK_SPEED;
|
||||
|
@ -507,7 +507,7 @@ void CHud::RenderWarmupTimer()
|
|||
str_format(Buf, sizeof(Buf), "%d.%d", Seconds, (m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer*10/SERVER_TICK_SPEED)%10);
|
||||
else
|
||||
str_format(Buf, sizeof(Buf), "%d", Seconds);
|
||||
w = TextRender()->TextWidth(0, FontSize, Buf, -1);
|
||||
w = TextRender()->TextWidth(0, FontSize, Buf, -1, -1.0f);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, Buf, -1);
|
||||
}
|
||||
}
|
||||
|
@ -530,17 +530,17 @@ void CHud::RenderTextInfo()
|
|||
int FrameTime = (int)(1.0f / m_FrameTimeAvg + 0.5f);
|
||||
str_format(Buf, sizeof(Buf), "%d", FrameTime);
|
||||
|
||||
static float s_TextWidth0 = TextRender()->TextWidth(0, 12.f, "0", -1);
|
||||
static float s_TextWidth00 = TextRender()->TextWidth(0, 12.f, "00", -1);
|
||||
static float s_TextWidth000 = TextRender()->TextWidth(0, 12.f, "000", -1);
|
||||
static float s_TextWidth0000 = TextRender()->TextWidth(0, 12.f, "0000", -1);
|
||||
static float s_TextWidth00000 = TextRender()->TextWidth(0, 12.f, "00000", -1);
|
||||
static float s_TextWidth0 = TextRender()->TextWidth(0, 12.f, "0", -1, -1.0f);
|
||||
static float s_TextWidth00 = TextRender()->TextWidth(0, 12.f, "00", -1, -1.0f);
|
||||
static float s_TextWidth000 = TextRender()->TextWidth(0, 12.f, "000", -1, -1.0f);
|
||||
static float s_TextWidth0000 = TextRender()->TextWidth(0, 12.f, "0000", -1, -1.0f);
|
||||
static float s_TextWidth00000 = TextRender()->TextWidth(0, 12.f, "00000", -1, -1.0f);
|
||||
static float s_TextWidth[5] = { s_TextWidth0, s_TextWidth00, s_TextWidth000, s_TextWidth0000, s_TextWidth00000 };
|
||||
|
||||
int DigitIndex = (int)log10((FrameTime ? FrameTime : 1));
|
||||
if(DigitIndex > 4)
|
||||
DigitIndex = 4;
|
||||
//TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,Buf,-1), 5, 12, Buf, -1);
|
||||
//TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,Buf,-1,-1.0f), 5, 12, Buf, -1);
|
||||
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, m_Width - 10 - s_TextWidth[DigitIndex], 5, 12, TEXTFLAG_RENDER);
|
||||
|
@ -564,7 +564,7 @@ void CHud::RenderTextInfo()
|
|||
{
|
||||
char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Client()->GetPredictionTime());
|
||||
TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,aBuf,-1), g_Config.m_ClShowfps ? 20 : 5, 12, aBuf, -1);
|
||||
TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,aBuf,-1,-1.0f), g_Config.m_ClShowfps ? 20 : 5, 12, aBuf, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,7 +573,7 @@ void CHud::RenderConnectionWarning()
|
|||
if(Client()->ConnectionProblems())
|
||||
{
|
||||
const char *pText = Localize("Connection Problems...");
|
||||
float w = TextRender()->TextWidth(0, 24, pText, -1);
|
||||
float w = TextRender()->TextWidth(0, 24, pText, -1, -1.0f);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-w/2, 50, 24, pText, -1);
|
||||
}
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ void CHud::RenderVoting()
|
|||
CTextCursor Cursor;
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), Localize("%ds left"), m_pClient->m_pVoting->SecondsLeft());
|
||||
float tw = TextRender()->TextWidth(0x0, 6, aBuf, -1);
|
||||
float tw = TextRender()->TextWidth(0x0, 6, aBuf, -1, -1.0f);
|
||||
TextRender()->SetCursor(&Cursor, 5.0f+100.0f-tw, 60.0f, 6.0f, TEXTFLAG_RENDER);
|
||||
TextRender()->TextEx(&Cursor, aBuf, -1);
|
||||
|
||||
|
@ -894,7 +894,7 @@ void CHud::RenderDDRaceEffects()
|
|||
if(m_FinishTime)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "Finish time: %02d:%02d.%02d", m_DDRaceTime/6000, m_DDRaceTime/100-m_DDRaceTime/6000 * 60, m_DDRaceTime % 100);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0,12,aBuf,-1)/2, 20, 12, aBuf, -1);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 12, aBuf, -1, -1.0f)/2, 20, 12, aBuf, -1);
|
||||
}
|
||||
else if(m_CheckpointTick + Client()->GameTickSpeed()*6 > Client()->GameTick(g_Config.m_ClDummy))
|
||||
{
|
||||
|
@ -914,7 +914,7 @@ void CHud::RenderDDRaceEffects()
|
|||
TextRender()->TextColor(0.5f,1.0f,0.5f,a); // green
|
||||
else if(!m_CheckpointDiff)
|
||||
TextRender()->TextColor(1,1,1,a); // white
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 10, aBuf, -1)/2, 20, 10, aBuf, -1);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f)/2, 20, 10, aBuf, -1);
|
||||
|
||||
TextRender()->TextColor(1,1,1,1);
|
||||
}
|
||||
|
@ -922,7 +922,7 @@ void CHud::RenderDDRaceEffects()
|
|||
/*else if(m_DDRaceTimeReceived)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%02d:%02d.%d", m_DDRaceTime/60, m_DDRaceTime%60, m_DDRaceTick/10);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 12,"00:00.0",-1)/2, 20, 12, aBuf, -1); // use fixed value for text width so its not shaky
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 12, "00:00.0", -1, -1.0f)/2, 20, 12, aBuf, -1); // use fixed value for text width so its not shaky
|
||||
}*/
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ void CKillMessages::OnMessage(int MsgType, void *pRawMsg)
|
|||
float FontSize = 36.0f;
|
||||
if(Kill.m_aVictimName[0] != 0)
|
||||
{
|
||||
Kill.m_VitctimTextWidth = TextRender()->TextWidth(0, FontSize, Kill.m_aVictimName, -1);
|
||||
Kill.m_VitctimTextWidth = TextRender()->TextWidth(0, FontSize, Kill.m_aVictimName, -1, -1.0f);
|
||||
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, 0, 0, FontSize, TEXTFLAG_RENDER);
|
||||
|
@ -108,7 +108,7 @@ void CKillMessages::OnMessage(int MsgType, void *pRawMsg)
|
|||
|
||||
if(Kill.m_aKillerName[0] != 0)
|
||||
{
|
||||
Kill.m_KillerTextWidth = TextRender()->TextWidth(0, FontSize, Kill.m_aKillerName, -1);
|
||||
Kill.m_KillerTextWidth = TextRender()->TextWidth(0, FontSize, Kill.m_aKillerName, -1, -1.0f);
|
||||
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, 0, 0, FontSize, TEXTFLAG_RENDER);
|
||||
|
|
|
@ -272,7 +272,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
|
||||
for(int i = 1; i <= Len; i++)
|
||||
{
|
||||
if(TextRender()->TextWidth(0, FontSize, pStr, i) - *Offset > MxRel)
|
||||
if(TextRender()->TextWidth(0, FontSize, pStr, i, -1.0f) - *Offset > MxRel)
|
||||
{
|
||||
s_AtIndex = i - 1;
|
||||
break;
|
||||
|
@ -388,11 +388,11 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
// check if the text has to be moved
|
||||
if(UI()->LastActiveItem() == pID && !JustGotActive && (UpdateOffset || m_NumInputEvents))
|
||||
{
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex, -1.0f);
|
||||
if(w-*Offset > Textbox.w)
|
||||
{
|
||||
// move to the left
|
||||
float wt = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1);
|
||||
float wt = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1, -1.0f);
|
||||
do
|
||||
{
|
||||
*Offset += minimum(wt-*Offset-Textbox.w, Textbox.w/3);
|
||||
|
@ -421,17 +421,17 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
|
|||
{
|
||||
if(str_length(aInputing))
|
||||
{
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex + Input()->GetEditingCursor());
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex + Input()->GetEditingCursor(), -1.0f);
|
||||
Textbox = *pRect;
|
||||
Textbox.VSplitLeft(2.0f, 0, &Textbox);
|
||||
Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1)/2);
|
||||
Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1, -1.0f)/2);
|
||||
|
||||
UI()->DoLabel(&Textbox, "|", FontSize, -1);
|
||||
}
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex, -1.0f);
|
||||
Textbox = *pRect;
|
||||
Textbox.VSplitLeft(2.0f, 0, &Textbox);
|
||||
Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1)/2);
|
||||
Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1, -1.0f)/2);
|
||||
|
||||
if((2*time_get()/time_freq()) % 2) // make it blink
|
||||
UI()->DoLabel(&Textbox, "|", FontSize, -1);
|
||||
|
@ -1208,7 +1208,7 @@ int CMenus::Render()
|
|||
Box.HSplitTop(20.f/UI()->Scale(), &Part, &Box);
|
||||
Box.HSplitTop(24.f/UI()->Scale(), &Part, &Box);
|
||||
Part.VMargin(20.f/UI()->Scale(), &Part);
|
||||
if(TextRender()->TextWidth(0, 24.f, pTitle, -1) > Part.w)
|
||||
if(TextRender()->TextWidth(0, 24.f, pTitle, -1, -1.0f) > Part.w)
|
||||
UI()->DoLabelScaled(&Part, pTitle, 24.f, -1, (int)Part.w);
|
||||
else
|
||||
UI()->DoLabelScaled(&Part, pTitle, 24.f, 0);
|
||||
|
@ -1222,7 +1222,7 @@ int CMenus::Render()
|
|||
UI()->DoLabelScaled(&Part, pExtraText, FontSize, -1, (int)Part.w);
|
||||
else
|
||||
{
|
||||
if(TextRender()->TextWidth(0, FontSize, pExtraText, -1) > Part.w)
|
||||
if(TextRender()->TextWidth(0, FontSize, pExtraText, -1, -1.0f) > Part.w)
|
||||
UI()->DoLabelScaled(&Part, pExtraText, FontSize, -1, (int)Part.w);
|
||||
else
|
||||
UI()->DoLabelScaled(&Part, pExtraText, FontSize, 0, -1);
|
||||
|
|
|
@ -492,7 +492,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
|
||||
UI()->DoLabelScaled(&QuickSearch, pLabel, 16.0f, -1);
|
||||
float w = TextRender()->TextWidth(0, 16.0f, pLabel, -1);
|
||||
float w = TextRender()->TextWidth(0, 16.0f, pLabel, -1, -1.0f);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
QuickSearch.VSplitLeft(w, 0, &QuickSearch);
|
||||
|
@ -511,7 +511,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
|
||||
UI()->DoLabelScaled(&QuickExclude, pLabel, 16.0f, -1);
|
||||
float w = TextRender()->TextWidth(0, 16.0f, pLabel, -1);
|
||||
float w = TextRender()->TextWidth(0, 16.0f, pLabel, -1, -1.0f);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
QuickExclude.VSplitLeft(w, 0, &QuickExclude);
|
||||
|
@ -528,7 +528,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
// render status
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers, %d players"), ServerBrowser()->NumSortedServers(), ServerBrowser()->NumServers(), NumPlayers);
|
||||
Status3.VSplitRight(TextRender()->TextWidth(0, 14.0f, aBuf, -1), 0, &Status3);
|
||||
Status3.VSplitRight(TextRender()->TextWidth(0, 14.0f, aBuf, -1, -1.0f), 0, &Status3);
|
||||
UI()->DoLabelScaled(&Status3, aBuf, 14.0f, -1);
|
||||
}
|
||||
|
||||
|
@ -1321,7 +1321,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
|
|||
UI()->DoLabelScaled(&Button, aBuf, 14.0f, -1);
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
Button.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1) + 10.0f, &Button, &Part);
|
||||
Button.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1, -1.0f) + 10.0f, &Button, &Part);
|
||||
|
||||
if(State == IUpdater::CLEAN && NeedUpdate)
|
||||
{
|
||||
|
|
|
@ -617,7 +617,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
|
||||
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1);
|
||||
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1);
|
||||
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch);
|
||||
|
@ -672,7 +672,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
Reason.HSplitTop(5.0f, 0, &Reason);
|
||||
const char *pLabel = Localize("Reason:");
|
||||
UI()->DoLabelScaled(&Reason, pLabel, 14.0f, -1);
|
||||
float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1);
|
||||
float w = TextRender()->TextWidth(0, 14.0f, pLabel, -1, -1.0f);
|
||||
Reason.VSplitLeft(w+10.0f, 0, &Reason);
|
||||
static float s_Offset = 0.0f;
|
||||
if(Input()->KeyPress(KEY_R) && (Input()->KeyIsPressed(KEY_LCTRL) || Input()->KeyIsPressed(KEY_RCTRL)))
|
||||
|
|
|
@ -620,7 +620,7 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
|
|||
TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT));
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
|
||||
UI()->DoLabelScaled(&QuickSearch, pSearchLabel, 14.0f, -1);
|
||||
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1);
|
||||
float wSearch = TextRender()->TextWidth(0, 14.0f, pSearchLabel, -1, -1.0f);
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetCurFont(NULL);
|
||||
QuickSearch.VSplitLeft(wSearch, 0, &QuickSearch);
|
||||
|
@ -1433,7 +1433,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
MainView.HSplitTop(150.0f, &HUD, &MainView);
|
||||
|
||||
HUD.HSplitTop(30.0f, &Label, &HUD);
|
||||
float tw = TextRender()->TextWidth(0, 20.0f, Localize("HUD"), -1);
|
||||
float tw = TextRender()->TextWidth(0, 20.0f, Localize("HUD"), -1, -1.0f);
|
||||
Label.VSplitLeft(tw + 10.0f, &Label, &Page1Tab);
|
||||
Page1Tab.VSplitLeft(60.0f, &Page1Tab, 0);
|
||||
Page1Tab.VSplitLeft(30.0f, &Page1Tab, &Page2Tab);
|
||||
|
@ -1537,7 +1537,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
char name[16];
|
||||
str_copy(name, g_Config.m_PlayerName, sizeof(name));
|
||||
str_format(aBuf, sizeof(aBuf), "*** '%s' entered and joined the spectators", name);
|
||||
while(TextRender()->TextWidth(0, 12.0f, aBuf, -1) > Label.w)
|
||||
while(TextRender()->TextWidth(0, 12.0f, aBuf, -1, -1.0f) > Label.w)
|
||||
{
|
||||
name[str_length(name) - 1] = 0;
|
||||
str_format(aBuf, sizeof(aBuf), "*** '%s' entered and joined the spectators", name);
|
||||
|
@ -1565,7 +1565,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
Right.HSplitTop(10.0f, &Label, &Right);
|
||||
|
||||
TextRender()->TextColor(0.75f, 0.5f, 0.75f, 1.0f);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Spectator"), -1);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Spectator"), -1, -1.0f);
|
||||
Label.VSplitLeft(tw, &Label, &Button);
|
||||
UI()->DoLabelScaled(&Label, Localize("Spectator"), 12.0f, -1);
|
||||
|
||||
|
@ -1574,7 +1574,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
char name[16];
|
||||
str_copy(name, g_Config.m_PlayerName, sizeof(name));
|
||||
str_format(aBuf, sizeof(aBuf), ": %s: %s", name, Localize ("Look out!"));
|
||||
while(TextRender()->TextWidth(0, 12.0f, aBuf, -1) > Button.w)
|
||||
while(TextRender()->TextWidth(0, 12.0f, aBuf, -1, -1.0f) > Button.w)
|
||||
{
|
||||
name[str_length(name) - 1] = 0;
|
||||
str_format(aBuf, sizeof(aBuf), ": %s: %s", name, Localize("Look out!"));
|
||||
|
@ -1604,7 +1604,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
|
||||
ColorRGBA rgbn = CalculateNameColor(TMColor);
|
||||
TextRender()->TextColor(rgbn);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Player"), -1);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Player"), -1, -1.0f);
|
||||
Label.VSplitLeft(tw, &Label, &Button);
|
||||
UI()->DoLabelScaled(&Label, Localize("Player"), 12.0f, -1);
|
||||
|
||||
|
@ -1620,7 +1620,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
char aBuf[64];
|
||||
Right.HSplitTop(20.0f, &Label, &Right);
|
||||
Label.VSplitRight(50.0f, &Label, &Button);
|
||||
float twh = TextRender()->TextWidth(0, 16.0f, Localize("Friend message"), -1) ;
|
||||
float twh = TextRender()->TextWidth(0, 16.0f, Localize("Friend message"), -1, -1.0f) ;
|
||||
Label.VSplitLeft(twh + 5.0f, &Label, &Enable);
|
||||
Enable.VSplitLeft(20.0f, &Enable, 0);
|
||||
UI()->DoLabelScaled(&Label, Localize("Friend message"), 16.0f, -1);
|
||||
|
@ -1641,12 +1641,12 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
|
||||
ColorRGBA rgbf = color_cast<ColorRGBA>(FMColor);
|
||||
TextRender()->TextColor(rgbf);
|
||||
float hw = TextRender()->TextWidth(0, 12.0f, "♥ ", -1);
|
||||
float hw = TextRender()->TextWidth(0, 12.0f, "♥ ", -1, -1.0f);
|
||||
Label.VSplitLeft(hw, &Heart, &Label);
|
||||
UI()->DoLabelScaled(&Heart, "♥ ", 12.0f, -1);
|
||||
|
||||
TextRender()->TextColor(0.8f, 0.8f, 0.8f, 1.0f);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Friend"), -1);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Friend"), -1, -1.0f);
|
||||
Label.VSplitLeft(tw, &Label, &Button);
|
||||
UI()->DoLabelScaled(&Label, Localize("Friend"), 12.0f, -1);
|
||||
|
||||
|
@ -1677,7 +1677,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
Left.HSplitTop(10.0f, &Label, &Left);
|
||||
|
||||
TextRender()->TextColor(0.8f, 0.8f, 0.8f, 1.0f);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Player"), -1);
|
||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Player"), -1, -1.0f);
|
||||
Label.VSplitLeft(tw, &Label, &Button);
|
||||
UI()->DoLabelScaled(&Label, Localize("Player"), 12.0f, -1);
|
||||
|
||||
|
@ -1695,7 +1695,7 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
|
|||
//RenderTools()->DrawUIRect(&Laser, vec4(1.0f, 1.0f, 1.0f, 0.1f), CUI::CORNER_ALL, 5.0f);
|
||||
//Laser.Margin(10.0f, &Laser);
|
||||
Laser.HSplitTop(30.0f, &Label, &Laser);
|
||||
Label.VSplitLeft(TextRender()->TextWidth(0, 20.0f, Localize("Laser"), -1) + 5.0f, &Label, &Weapon);
|
||||
Label.VSplitLeft(TextRender()->TextWidth(0, 20.0f, Localize("Laser"), -1, -1.0f) + 5.0f, &Label, &Weapon);
|
||||
UI()->DoLabelScaled(&Label, Localize("Laser"), 20.0f, -1);
|
||||
|
||||
Laser.HSplitTop(20.0f, &Label, &Laser);
|
||||
|
@ -2087,7 +2087,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
|||
if(NeedUpdate && State <= IUpdater::CLEAN)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), Localize("DDNet %s is available:"), Client()->LatestVersion());
|
||||
Label.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1) + 10.0f, &Label, &Button);
|
||||
Label.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1, -1.0f) + 10.0f, &Label, &Button);
|
||||
Button.VSplitLeft(100.0f, &Button, 0);
|
||||
static int s_ButtonUpdate = 0;
|
||||
if(DoButton_Menu(&s_ButtonUpdate, Localize("Update now"), 0, &Button))
|
||||
|
@ -2103,7 +2103,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
|||
else
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), Localize("No updates available"));
|
||||
Label.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1) + 10.0f, &Label, &Button);
|
||||
Label.VSplitLeft(TextRender()->TextWidth(0, 14.0f, aBuf, -1, -1.0f) + 10.0f, &Label, &Button);
|
||||
Button.VSplitLeft(100.0f, &Button, 0);
|
||||
static int s_ButtonUpdate = 0;
|
||||
if(DoButton_Menu(&s_ButtonUpdate, Localize("Check now"), 0, &Button))
|
||||
|
|
|
@ -73,7 +73,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
|
||||
MapscreenToGroup(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y, Layers()->GameGroup());
|
||||
|
||||
m_aNamePlates[ClientID].m_NameTextWidth = TextRender()->TextWidth(0, FontSize, pName, -1);
|
||||
m_aNamePlates[ClientID].m_NameTextWidth = TextRender()->TextWidth(0, FontSize, pName, -1, -1.0f);
|
||||
|
||||
m_aNamePlates[ClientID].m_NameTextContainerIndex = TextRender()->CreateTextContainer(&Cursor, pName);
|
||||
Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1);
|
||||
|
@ -99,7 +99,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
|
||||
MapscreenToGroup(m_pClient->m_pCamera->m_Center.x, m_pClient->m_pCamera->m_Center.y, Layers()->GameGroup());
|
||||
|
||||
m_aNamePlates[ClientID].m_ClanNameTextWidth = TextRender()->TextWidth(0, FontSizeClan, pClan, -1);
|
||||
m_aNamePlates[ClientID].m_ClanNameTextWidth = TextRender()->TextWidth(0, FontSizeClan, pClan, -1, -1.0f);
|
||||
|
||||
m_aNamePlates[ClientID].m_ClanNameTextContainerIndex = TextRender()->CreateTextContainer(&Cursor, pClan);
|
||||
Graphics()->MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1);
|
||||
|
@ -149,7 +149,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf),"%d", pPlayerInfo->m_ClientID);
|
||||
float Offset = g_Config.m_ClNameplatesClan ? (FontSize * 2 + FontSizeClan) : (FontSize * 2);
|
||||
float tw_id = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
float tw_id = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->TextColor(rgb);
|
||||
TextRender()->Text(0, Position.x-tw_id/2.0f, Position.y-Offset-38.0f, 28.0f, aBuf, -1);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ void CScoreboard::RenderGoals(float x, float y, float w)
|
|||
{
|
||||
char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), "%s %d/%d", Localize("Round"), m_pClient->m_Snap.m_pGameInfoObj->m_RoundCurrent, m_pClient->m_Snap.m_pGameInfoObj->m_RoundNum);
|
||||
float tw = TextRender()->TextWidth(0, 20.0f, aBuf, -1);
|
||||
float tw = TextRender()->TextWidth(0, 20.0f, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x+w-tw-10.0f, y + (h - 20.f) / 2.f, 20.0f, aBuf, -1);
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
|
||||
if (!lower16 && !lower32 && !lower24)
|
||||
{
|
||||
tw = TextRender()->TextWidth(0, TitleFontsize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, TitleFontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x+w-tw-20.0f, y + (50.f - TitleFontsize) / 2.f, TitleFontsize, aBuf, -1);
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
RoundRadius = 15.0f;
|
||||
}
|
||||
|
||||
float ScoreOffset = x+10.0f, ScoreLength = TextRender()->TextWidth(0, 22.0f/*HeadlineFontsize*/, "00:00:0", -1);
|
||||
float ScoreOffset = x+10.0f, ScoreLength = TextRender()->TextWidth(0, 22.0f/*HeadlineFontsize*/, "00:00:0", -1, -1.0f);
|
||||
float TeeOffset = ScoreOffset+ScoreLength, TeeLength = 60*TeeSizeMod;
|
||||
float NameOffset = TeeOffset+TeeLength, NameLength = 300.0f-TeeLength;
|
||||
float PingOffset = x+610.0f, PingLength = 65.0f;
|
||||
|
@ -302,16 +302,16 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
y += 50.0f;
|
||||
float HeadlineFontsize = 22.0f;
|
||||
const char *pScore = (m_pClient->m_GameInfo.m_TimeScore && g_Config.m_ClDDRaceScoreBoard) ? Localize("Time") : Localize("Score");
|
||||
float ScoreWidth = TextRender()->TextWidth(0, HeadlineFontsize, pScore, -1);
|
||||
float ScoreWidth = TextRender()->TextWidth(0, HeadlineFontsize, pScore, -1, -1.0f);
|
||||
tw = ScoreLength > ScoreWidth ? ScoreLength : ScoreWidth;
|
||||
TextRender()->Text(0, ScoreOffset+ScoreLength-tw, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, pScore, -1);
|
||||
|
||||
TextRender()->Text(0, NameOffset, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Name"), -1);
|
||||
|
||||
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Clan"), -1);
|
||||
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Clan"), -1, -1.0f);
|
||||
TextRender()->Text(0, ClanOffset+ClanLength/2-tw/2, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Clan"), -1);
|
||||
|
||||
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Ping"), -1);
|
||||
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Ping"), -1, -1.0f);
|
||||
TextRender()->Text(0, PingOffset+PingLength-tw, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Ping"), -1);
|
||||
|
||||
// render player entries
|
||||
|
@ -400,7 +400,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
else
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf),"Team %d", DDTeam);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->SetCursor(&Cursor, ScoreOffset+w/2.0f-tw/2.0f, y + LineHeight, FontSize/1.5f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = NameLength+3;
|
||||
}
|
||||
|
@ -433,7 +433,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
}
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Score, -999, 99999));
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->SetCursor(&Cursor, ScoreOffset+ScoreLength-tw, y + (LineHeight - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER);
|
||||
TextRender()->TextEx(&Cursor, aBuf, -1);
|
||||
|
||||
|
@ -491,7 +491,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
else
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
tw = TextRender()->TextWidth(nullptr, FontSize, m_pClient->m_aClients[pInfo->m_ClientID].m_aClan, -1);
|
||||
tw = TextRender()->TextWidth(nullptr, FontSize, m_pClient->m_aClients[pInfo->m_ClientID].m_aClan, -1, -1.0f);
|
||||
TextRender()->SetCursor(&Cursor, ClanOffset + ClanLength / 2 - tw / 2, y + (LineHeight - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = ClanLength;
|
||||
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[pInfo->m_ClientID].m_aClan, -1);
|
||||
|
@ -510,7 +510,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
TextRender()->TextColor(rgb);
|
||||
}
|
||||
str_format(aBuf, sizeof(aBuf), "%d", clamp(pInfo->m_Latency, 0, 999));
|
||||
tw = TextRender()->TextWidth(nullptr, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(nullptr, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->SetCursor(&Cursor, PingOffset+PingLength-tw, y + (LineHeight - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = PingLength;
|
||||
TextRender()->TextEx(&Cursor, aBuf, -1);
|
||||
|
@ -568,7 +568,7 @@ void CScoreboard::RenderRecordingNotification(float x)
|
|||
str_append(aBuf, aBuf2, sizeof(aBuf));
|
||||
}
|
||||
|
||||
float w = TextRender()->TextWidth(0, 20.0f, aBuf, -1);
|
||||
float w = TextRender()->TextWidth(0, 20.0f, aBuf, -1, -1.0f);
|
||||
|
||||
//draw the box
|
||||
Graphics()->BlendNormal();
|
||||
|
@ -651,7 +651,7 @@ void CScoreboard::OnRender()
|
|||
str_copy(aText, Localize("Blue team wins!"), sizeof(aText));
|
||||
}
|
||||
|
||||
float w = TextRender()->TextWidth(0, 86.0f, aText, -1);
|
||||
float w = TextRender()->TextWidth(0, 86.0f, aText, -1, -1.0f);
|
||||
TextRender()->Text(0, Width/2-w/2, 39, 86.0f, aText, -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ void CStatboard::RenderGlobalStats()
|
|||
px += 10.0f; // Suicides
|
||||
if(i == 8 && !GameWithFlags) // Don't draw "Grabs" in game with no flag
|
||||
continue;
|
||||
tw = TextRender()->TextWidth(0, 22.0f, apHeaders[i], -1);
|
||||
tw = TextRender()->TextWidth(0, 22.0f, apHeaders[i], -1, -1.0f);
|
||||
TextRender()->Text(0, x+px-tw, y-5, 22.0f, apHeaders[i], -1);
|
||||
px += 85;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ void CStatboard::RenderGlobalStats()
|
|||
|
||||
char aBuf[128];
|
||||
CTextCursor Cursor;
|
||||
tw = TextRender()->TextWidth(0, FontSize, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1, -1.0f);
|
||||
TextRender()->SetCursor(&Cursor, x+64, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END);
|
||||
Cursor.m_LineWidth = 220;
|
||||
TextRender()->TextEx(&Cursor, m_pClient->m_aClients[pInfo->m_ClientID].m_aName, -1);
|
||||
|
@ -295,14 +295,14 @@ void CStatboard::RenderGlobalStats()
|
|||
// FRAGS
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Frags);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
// DEATHS
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Deaths);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ void CStatboard::RenderGlobalStats()
|
|||
{
|
||||
px += 10;
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Suicides);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
|
@ -320,14 +320,14 @@ void CStatboard::RenderGlobalStats()
|
|||
str_format(aBuf, sizeof(aBuf), "--");
|
||||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", (float)(pStats->m_Frags)/pStats->m_Deaths);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
// NET
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%+d", pStats->m_Frags-pStats->m_Deaths);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
|
@ -335,21 +335,21 @@ void CStatboard::RenderGlobalStats()
|
|||
{
|
||||
float Fpm = pStats->GetFPM(Client()->GameTick(g_Config.m_ClDummy), Client()->GameTickSpeed());
|
||||
str_format(aBuf, sizeof(aBuf), "%.1f", Fpm);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
// SPREE
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_CurrentSpree);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
// BEST SPREE
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_BestSpree);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ void CStatboard::RenderGlobalStats()
|
|||
if(GameWithFlags)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagGrabs);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ void CStatboard::RenderGlobalStats()
|
|||
continue;
|
||||
|
||||
str_format(aBuf, sizeof(aBuf), "%d/%d", pStats->m_aFragsWith[i], pStats->m_aDeathsFrom[i]);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x+px-tw/2, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 80;
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ void CStatboard::RenderGlobalStats()
|
|||
if(GameWithFlags)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagCaptures);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1);
|
||||
px += 85;
|
||||
}
|
||||
|
|
|
@ -381,19 +381,19 @@ void CUI::DoLabel(const CUIRect *r, const char *pText, float Size, int Align, in
|
|||
if(Align == 0)
|
||||
{
|
||||
float AlignedSize = 0;
|
||||
float tw = TextRender()->TextWidth(0, Size, pText, MaxWidth, &AlignedSize);
|
||||
float tw = TextRender()->TextWidth(0, Size, pText, -1, MaxWidth, &AlignedSize);
|
||||
TextRender()->Text(0, r->x + (r->w - tw) / 2.f, r->y + (r->h - AlignedSize) / 2.f, Size, pText, MaxWidth);
|
||||
}
|
||||
else if(Align < 0)
|
||||
{
|
||||
float AlignedSize = 0;
|
||||
TextRender()->TextWidth(0, Size, pText, MaxWidth, &AlignedSize);
|
||||
TextRender()->TextWidth(0, Size, pText, -1, MaxWidth, &AlignedSize);
|
||||
TextRender()->Text(0, r->x, r->y + (r->h - AlignedSize) / 2.f, Size, pText, MaxWidth);
|
||||
}
|
||||
else if(Align > 0)
|
||||
{
|
||||
float AlignedSize = 0;
|
||||
float tw = TextRender()->TextWidth(0, Size, pText, MaxWidth, &AlignedSize);
|
||||
float tw = TextRender()->TextWidth(0, Size, pText, -1, MaxWidth, &AlignedSize);
|
||||
TextRender()->Text(0, r->x + r->w-tw, r->y + (r->h - AlignedSize) / 2.f, Size, pText, MaxWidth);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
|
|||
|
||||
for(int i = 1; i <= Len; i++)
|
||||
{
|
||||
if(TextRender()->TextWidth(0, FontSize, pStr, i) - *Offset > MxRel)
|
||||
if(TextRender()->TextWidth(0, FontSize, pStr, i, -1.0f) - *Offset > MxRel)
|
||||
{
|
||||
s_AtIndex = i - 1;
|
||||
break;
|
||||
|
@ -428,11 +428,11 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
|
|||
// check if the text has to be moved
|
||||
if(UI()->LastActiveItem() == pID && !JustGotActive && (UpdateOffset || Input()->NumEvents()))
|
||||
{
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex, -1.0f);
|
||||
if(w-*Offset > Textbox.w)
|
||||
{
|
||||
// move to the left
|
||||
float wt = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1);
|
||||
float wt = TextRender()->TextWidth(0, FontSize, pDisplayStr, -1, -1.0f);
|
||||
do
|
||||
{
|
||||
*Offset += minimum(wt-*Offset-Textbox.w, Textbox.w/3);
|
||||
|
@ -457,10 +457,10 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str
|
|||
// render the cursor
|
||||
if(UI()->LastActiveItem() == pID && !JustGotActive)
|
||||
{
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex);
|
||||
float w = TextRender()->TextWidth(0, FontSize, pDisplayStr, s_AtIndex, -1.0f);
|
||||
Textbox = *pRect;
|
||||
Textbox.VSplitLeft(2.0f, 0, &Textbox);
|
||||
Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1)/2);
|
||||
Textbox.x += (w-*Offset-TextRender()->TextWidth(0, FontSize, "|", -1, -1.0f)/2);
|
||||
|
||||
if((2*time_get()/time_freq()) % 2) // make it blink
|
||||
UI()->DoLabel(&Textbox, "|", FontSize, -1);
|
||||
|
@ -3107,7 +3107,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
else
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%s", m_Map.m_lImages[pProps[i].m_Value]->m_aName);
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Shifter.w)
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) > Shifter.w)
|
||||
{
|
||||
if(FontSize > 6.0f)
|
||||
{
|
||||
|
@ -3176,7 +3176,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
else
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%s", m_Map.m_lSounds[pProps[i].m_Value]->m_aName);
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Shifter.w)
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) > Shifter.w)
|
||||
{
|
||||
if(FontSize > 6.0f)
|
||||
{
|
||||
|
@ -3237,7 +3237,7 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
|
|||
else
|
||||
str_format(aBuf, sizeof(aBuf), "%d", CurValue);
|
||||
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Shifter.w)
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) > Shifter.w)
|
||||
{
|
||||
if(FontSize > 6.0f)
|
||||
{
|
||||
|
@ -3345,7 +3345,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
|
|||
|
||||
str_format(aBuf, sizeof(aBuf),"#%d %s", g, m_Map.m_lGroups[g]->m_aName);
|
||||
float FontSize = 10.0f;
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Slot.w)
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) > Slot.w)
|
||||
FontSize--;
|
||||
if(int Result = DoButton_Ex(&m_Map.m_lGroups[g], aBuf, g==m_SelectedGroup, &Slot,
|
||||
BUTTON_CONTEXT, m_Map.m_lGroups[g]->m_Collapse ? "Select group. Shift click to select all layers. Double click to expand." : "Select group. Shift click to select all layers. Double click to collapse.", CUI::CORNER_R, FontSize))
|
||||
|
@ -3416,7 +3416,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
|
|||
}
|
||||
|
||||
float FontSize = 10.0f;
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Button.w)
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) > Button.w)
|
||||
FontSize--;
|
||||
int Checked = 0;
|
||||
if (g == m_SelectedGroup)
|
||||
|
@ -3935,7 +3935,7 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect View)
|
|||
}
|
||||
|
||||
float FontSize = 10.0f;
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Slot.w)
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) > Slot.w)
|
||||
FontSize--;
|
||||
|
||||
if(int Result = DoButton_Ex(&m_Map.m_lImages[i], aBuf, Selected, &Slot,
|
||||
|
@ -4089,7 +4089,7 @@ void CEditor::RenderSounds(CUIRect ToolBox, CUIRect View)
|
|||
Selected += 4; // Sound should be embedded
|
||||
|
||||
float FontSize = 10.0f;
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Slot.w)
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) > Slot.w)
|
||||
FontSize--;
|
||||
|
||||
if(int Result = DoButton_Ex(&m_Map.m_lSounds[i], aBuf, Selected, &Slot,
|
||||
|
@ -4656,7 +4656,7 @@ void CEditor::RenderStatusbar(CUIRect View)
|
|||
|
||||
float FontSize = 10.0f;
|
||||
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > View.w)
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f) > View.w)
|
||||
{
|
||||
if(FontSize > 6.0f)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue