mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #2515
2515: Port some text.cpp fixes r=def- a=Fireball-Teeworlds1ca020ea19
912442347d
The first one fixes a stack-buffer-overflow in some UIs (closes #2511), the second one is just for consistent typing. Co-authored-by: Fireball <fireball.teeworlds@gmail.com>
This commit is contained in:
commit
76566b57fb
|
@ -737,19 +737,20 @@ public:
|
|||
pCursor->m_CharCount = 0;
|
||||
}
|
||||
|
||||
virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, int MaxWidth)
|
||||
virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, float LineWidth)
|
||||
{
|
||||
CTextCursor Cursor;
|
||||
SetCursor(&Cursor, x, y, Size, TEXTFLAG_RENDER);
|
||||
Cursor.m_LineWidth = MaxWidth;
|
||||
Cursor.m_LineWidth = LineWidth;
|
||||
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;
|
||||
|
|
|
@ -107,8 +107,8 @@ public:
|
|||
virtual void TextColor(float r, float g, float b, float a) = 0;
|
||||
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 void Text(void *pFontSetV, float x, float y, float Size, const char *pText, float LineWidth) = 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;
|
||||
|
@ -707,12 +707,12 @@ void CGameConsole::OnRender()
|
|||
char aBuf[128];
|
||||
TextRender()->TextColor(1,1,1,1);
|
||||
str_format(aBuf, sizeof(aBuf), Localize("-Page %d-"), pConsole->m_BacklogActPage+1);
|
||||
TextRender()->Text(0, 10.0f, FontSize / 2.f, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, 10.0f, FontSize / 2.f, FontSize, aBuf, -1.0f);
|
||||
|
||||
// render version
|
||||
str_format(aBuf, sizeof(aBuf), "v%s", GAME_VERSION);
|
||||
float Width = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, Screen.w-Width-10.0f, FontSize / 2.f, 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.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,40 +38,40 @@ void CDebugHud::RenderNetCorrections()
|
|||
|
||||
float x = Width-100.0f, y = 50.0f;
|
||||
for(int i = 0; i < Num; ++i)
|
||||
TextRender()->Text(0, x, y+i*LineHeight, Fontsize, paStrings[i], -1);
|
||||
TextRender()->Text(0, x, y+i*LineHeight, Fontsize, paStrings[i], -1.0f);
|
||||
|
||||
x = Width-10.0f;
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed/32);
|
||||
float w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
float w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
|
||||
y += LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed/32*Ramp);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
|
||||
y += LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", Ramp);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
|
||||
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);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
|
||||
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);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
|
||||
y += LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_Snap.m_pLocalCharacter->m_Angle);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
|
||||
y += 2*LineHeight;
|
||||
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->NetobjNumCorrections());
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
|
||||
y += LineHeight;
|
||||
w = TextRender()->TextWidth(0, Fontsize, m_pClient->NetobjCorrectedOn(), -1);
|
||||
TextRender()->Text(0, x-w, y, 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.0f);
|
||||
}
|
||||
|
||||
void CDebugHud::RenderTuning()
|
||||
|
@ -103,16 +103,16 @@ void CDebugHud::RenderTuning()
|
|||
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", Standard);
|
||||
x += 20.0f;
|
||||
w = TextRender()->TextWidth(0, 5, aBuf, -1);
|
||||
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, 5, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1.0f);
|
||||
|
||||
str_format(aBuf, sizeof(aBuf), "%.2f", Current);
|
||||
x += 20.0f;
|
||||
w = TextRender()->TextWidth(0, 5, aBuf, -1);
|
||||
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1);
|
||||
w = TextRender()->TextWidth(0, 5, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1.0f);
|
||||
|
||||
x += 5.0f;
|
||||
TextRender()->Text(0x0, x, y+Count*6, 5, m_pClient->m_Tuning[g_Config.m_ClDummy].ms_apNames[i], -1);
|
||||
TextRender()->Text(0x0, x, y+Count*6, 5, m_pClient->m_Tuning[g_Config.m_ClDummy].ms_apNames[i], -1.0f);
|
||||
|
||||
Count++;
|
||||
}
|
||||
|
|
|
@ -134,16 +134,16 @@ 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))
|
||||
{
|
||||
float Alpha = Time <= 10 && (2*time()/time_freq()) % 2 ? 0.5f : 1.0f;
|
||||
TextRender()->TextColor(1.0f, 0.25f, 0.25f, Alpha);
|
||||
}
|
||||
TextRender()->Text(0, Half-w/2, 2, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, Half-w/2, 2, FontSize, aBuf, -1.0f);
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -155,8 +155,8 @@ void CHud::RenderPauseNotification()
|
|||
{
|
||||
const char *pText = Localize("Game paused");
|
||||
float FontSize = 20.0f;
|
||||
float w = TextRender()->TextWidth(0, FontSize,pText, -1);
|
||||
TextRender()->Text(0, 150.0f*Graphics()->ScreenAspect()+-w/2.0f, 50.0f, 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.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,8 +167,8 @@ 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);
|
||||
TextRender()->Text(0, Half-w/2, 2, FontSize, pText, -1);
|
||||
float w = TextRender()->TextWidth(0, FontSize, pText, -1, -1.0f);
|
||||
TextRender()->Text(0, Half-w/2, 2, FontSize, pText, -1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,16 +499,16 @@ void CHud::RenderWarmupTimer()
|
|||
{
|
||||
char Buf[256];
|
||||
float FontSize = 20.0f;
|
||||
float w = TextRender()->TextWidth(0, FontSize, Localize("Warmup"), -1);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 50, 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.0f);
|
||||
|
||||
int Seconds = m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer/SERVER_TICK_SPEED;
|
||||
if(Seconds < 5)
|
||||
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);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, Buf, -1);
|
||||
w = TextRender()->TextWidth(0, FontSize, Buf, -1, -1.0f);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, Buf, -1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.0f);
|
||||
|
||||
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.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,8 +573,8 @@ void CHud::RenderConnectionWarning()
|
|||
if(Client()->ConnectionProblems())
|
||||
{
|
||||
const char *pText = Localize("Connection Problems...");
|
||||
float w = TextRender()->TextWidth(0, 24, pText, -1);
|
||||
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-w/2, 50, 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.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,7 +592,7 @@ void CHud::RenderTeambalanceWarning()
|
|||
TextRender()->TextColor(1,1,0.5f,1);
|
||||
else
|
||||
TextRender()->TextColor(0.7f,0.7f,0.2f,1.0f);
|
||||
TextRender()->Text(0x0, 5, 50, 6, pText, -1);
|
||||
TextRender()->Text(0x0, 5, 50, 6, pText, -1.0f);
|
||||
TextRender()->TextColor(1,1,1,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);
|
||||
|
||||
|
@ -740,7 +740,7 @@ void CHud::RenderSpectatorHud()
|
|||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Spectate"), m_pClient->m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW ?
|
||||
m_pClient->m_aClients[m_pClient->m_Snap.m_SpecInfo.m_SpectatorID].m_aName : Localize("Free-View"));
|
||||
TextRender()->Text(0, m_Width-174.0f, m_Height-15.0f + (15.f - 8.f) / 2.f, 8.0f, aBuf, -1);
|
||||
TextRender()->Text(0, m_Width-174.0f, m_Height-15.0f + (15.f - 8.f) / 2.f, 8.0f, aBuf, -1.0f);
|
||||
}
|
||||
|
||||
void CHud::RenderLocalTime(float x)
|
||||
|
@ -759,7 +759,7 @@ void CHud::RenderLocalTime(float x)
|
|||
//draw the text
|
||||
char aTimeStr[6];
|
||||
str_timestamp_format(aTimeStr, sizeof(aTimeStr), "%H:%M");
|
||||
TextRender()->Text(0, x-25.0f, (12.5f - 5.f) / 2.f, 5.0f, aTimeStr, -1);
|
||||
TextRender()->Text(0, x-25.0f, (12.5f - 5.f) / 2.f, 5.0f, aTimeStr, -1.0f);
|
||||
}
|
||||
|
||||
void CHud::OnRender()
|
||||
|
@ -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.0f);
|
||||
}
|
||||
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.0f);
|
||||
|
||||
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.0f); // use fixed value for text width so its not shaky
|
||||
}*/
|
||||
}
|
||||
|
||||
|
@ -932,9 +932,9 @@ void CHud::RenderRecord()
|
|||
{
|
||||
char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), Localize("Server best:"));
|
||||
TextRender()->Text(0, 5, 40, 6, aBuf, -1);
|
||||
TextRender()->Text(0, 5, 40, 6, aBuf, -1.0f);
|
||||
str_format(aBuf, sizeof(aBuf), "%02d:%05.2f", (int)m_ServerRecord/60, m_ServerRecord-((int)m_ServerRecord/60*60));
|
||||
TextRender()->Text(0, 53, 40, 6, aBuf, -1);
|
||||
TextRender()->Text(0, 53, 40, 6, aBuf, -1.0f);
|
||||
}
|
||||
|
||||
const float PlayerRecord = m_PlayerRecord[g_Config.m_ClDummy];
|
||||
|
@ -942,8 +942,8 @@ void CHud::RenderRecord()
|
|||
{
|
||||
char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), Localize("Personal best:"));
|
||||
TextRender()->Text(0, 5, 47, 6, aBuf, -1);
|
||||
TextRender()->Text(0, 5, 47, 6, aBuf, -1.0f);
|
||||
str_format(aBuf, sizeof(aBuf), "%02d:%05.2f", (int)PlayerRecord/60, PlayerRecord-((int)PlayerRecord/60*60));
|
||||
TextRender()->Text(0, 53, 47, 6, aBuf, -1);
|
||||
TextRender()->Text(0, 53, 47, 6, aBuf, -1.0f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -241,7 +241,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
|
|||
|
||||
char aSpeedBuf[256];
|
||||
str_format(aSpeedBuf, sizeof(aSpeedBuf), "×%.2f", pInfo->m_Speed);
|
||||
TextRender()->Text(0, 120.0f, Screen.y+Screen.h - 120.0f - TotalHeight, 60.0f, aSpeedBuf, -1);
|
||||
TextRender()->Text(0, 120.0f, Screen.y+Screen.h - 120.0f - TotalHeight, 60.0f, aSpeedBuf, -1.0f);
|
||||
}
|
||||
|
||||
if(!m_MenuActive)
|
||||
|
|
|
@ -391,7 +391,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
|||
x = 5.0f;
|
||||
y = 0.0f;
|
||||
|
||||
TextRender()->Text(0, ServerInfo.x+x, ServerInfo.y+y, 32, Localize("Server info"), 250);
|
||||
TextRender()->Text(0, ServerInfo.x+x, ServerInfo.y+y, 32, Localize("Server info"), 250.0f);
|
||||
y += 32.0f+5.0f;
|
||||
|
||||
mem_zero(aBuf, sizeof(aBuf));
|
||||
|
@ -410,7 +410,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
|||
Localize("Password"), CurrentServerInfo.m_Flags &1 ? Localize("Yes") : Localize("No")
|
||||
);
|
||||
|
||||
TextRender()->Text(0, ServerInfo.x+x, ServerInfo.y+y, 20, aBuf, 250);
|
||||
TextRender()->Text(0, ServerInfo.x+x, ServerInfo.y+y, 20, aBuf, 250.0f);
|
||||
|
||||
{
|
||||
CUIRect Button;
|
||||
|
@ -435,7 +435,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
|||
x = 5.0f;
|
||||
y = 0.0f;
|
||||
|
||||
TextRender()->Text(0, GameInfo.x+x, GameInfo.y+y, 32, Localize("Game info"), 250);
|
||||
TextRender()->Text(0, GameInfo.x+x, GameInfo.y+y, 32, Localize("Game info"), 250.0f);
|
||||
y += 32.0f+5.0f;
|
||||
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj)
|
||||
|
@ -457,7 +457,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
|||
Localize("Time limit"), m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit,
|
||||
Localize("Players"), m_pClient->m_Snap.m_NumPlayers, CurrentServerInfo.m_MaxClients
|
||||
);
|
||||
TextRender()->Text(0, GameInfo.x+x, GameInfo.y+y, 20, aBuf, 250);
|
||||
TextRender()->Text(0, GameInfo.x+x, GameInfo.y+y, 20, aBuf, 250.0f);
|
||||
}
|
||||
|
||||
// motd
|
||||
|
@ -466,9 +466,9 @@ void CMenus::RenderServerInfo(CUIRect MainView)
|
|||
Motd.Margin(5.0f, &Motd);
|
||||
y = 0.0f;
|
||||
x = 5.0f;
|
||||
TextRender()->Text(0, Motd.x+x, Motd.y+y, 32, Localize("MOTD"), -1);
|
||||
TextRender()->Text(0, Motd.x+x, Motd.y+y, 32, Localize("MOTD"), -1.0f);
|
||||
y += 32.0f+5.0f;
|
||||
TextRender()->Text(0, Motd.x+x, Motd.y+y, 16, m_pClient->m_pMotd->m_aServerMotd, (int)Motd.w);
|
||||
TextRender()->Text(0, Motd.x+x, Motd.y+y, 16, m_pClient->m_pMotd->m_aServerMotd, Motd.w);
|
||||
}
|
||||
|
||||
bool CMenus::RenderServerControlServer(CUIRect MainView)
|
||||
|
@ -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);
|
||||
|
@ -787,7 +787,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
RenderTools()->DrawUIRect(&MovementSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
|
||||
MovementSettings.VMargin(10.0f, &MovementSettings);
|
||||
|
||||
TextRender()->Text(0, MovementSettings.x, MovementSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Movement"), -1);
|
||||
TextRender()->Text(0, MovementSettings.x, MovementSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Movement"), -1.0f);
|
||||
|
||||
MovementSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &MovementSettings);
|
||||
|
||||
|
@ -828,7 +828,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
RenderTools()->DrawUIRect(&WeaponSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
|
||||
WeaponSettings.VMargin(10.0f, &WeaponSettings);
|
||||
|
||||
TextRender()->Text(0, WeaponSettings.x, WeaponSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Weapon"), -1);
|
||||
TextRender()->Text(0, WeaponSettings.x, WeaponSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Weapon"), -1.0f);
|
||||
|
||||
WeaponSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &WeaponSettings);
|
||||
UiDoGetButtons(18, 25, WeaponSettings, MainView);
|
||||
|
@ -854,7 +854,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
RenderTools()->DrawUIRect(&VotingSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
|
||||
VotingSettings.VMargin(10.0f, &VotingSettings);
|
||||
|
||||
TextRender()->Text(0, VotingSettings.x, VotingSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Voting"), -1);
|
||||
TextRender()->Text(0, VotingSettings.x, VotingSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Voting"), -1.0f);
|
||||
|
||||
VotingSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &VotingSettings);
|
||||
UiDoGetButtons(25, 27, VotingSettings, MainView);
|
||||
|
@ -867,7 +867,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
RenderTools()->DrawUIRect(&ChatSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
|
||||
ChatSettings.VMargin(10.0f, &ChatSettings);
|
||||
|
||||
TextRender()->Text(0, ChatSettings.x, ChatSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Chat"), -1);
|
||||
TextRender()->Text(0, ChatSettings.x, ChatSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Chat"), -1.0f);
|
||||
|
||||
ChatSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &ChatSettings);
|
||||
UiDoGetButtons(27, 31, ChatSettings, MainView);
|
||||
|
@ -880,7 +880,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
|
|||
RenderTools()->DrawUIRect(&MiscSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
|
||||
MiscSettings.VMargin(10.0f, &MiscSettings);
|
||||
|
||||
TextRender()->Text(0, MiscSettings.x, MiscSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Miscellaneous"), -1);
|
||||
TextRender()->Text(0, MiscSettings.x, MiscSettings.y + (14.0f + 5.0f + 10.0f - 14.0f*UI()->Scale()) / 2.f, 14.0f*UI()->Scale(), Localize("Miscellaneous"), -1.0f);
|
||||
|
||||
MiscSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &MiscSettings);
|
||||
UiDoGetButtons(31, 43, MiscSettings, MainView);
|
||||
|
@ -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))
|
||||
|
|
|
@ -49,7 +49,7 @@ void CMotd::OnRender()
|
|||
RenderTools()->DrawRoundRect(x, y, w, h, 40.0f);
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
TextRender()->Text(0, x+40.0f, y+40.0f, 32.0f, m_aServerMotd, (int)(w-80.0f));
|
||||
TextRender()->Text(0, x+40.0f, y+40.0f, 32.0f, m_aServerMotd, w-80.0f);
|
||||
}
|
||||
|
||||
void CMotd::OnMessage(int MsgType, void *pRawMsg)
|
||||
|
|
|
@ -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,9 +149,9 @@ 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);
|
||||
TextRender()->Text(0, Position.x-tw_id/2.0f, Position.y-Offset-38.0f, 28.0f, aBuf, -1.0f);
|
||||
}
|
||||
|
||||
TextRender()->TextColor(1,1,1,1);
|
||||
|
|
|
@ -77,20 +77,20 @@ void CScoreboard::RenderGoals(float x, float y, float w)
|
|||
{
|
||||
char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %d", Localize("Score limit"), m_pClient->m_Snap.m_pGameInfoObj->m_ScoreLimit);
|
||||
TextRender()->Text(0, x+10.0f, y + (h - 20.f) / 2.f, 20.0f, aBuf, -1);
|
||||
TextRender()->Text(0, x+10.0f, y + (h - 20.f) / 2.f, 20.0f, aBuf, -1.0f);
|
||||
}
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit)
|
||||
{
|
||||
char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), Localize("Time limit: %d min"), m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit);
|
||||
TextRender()->Text(0, x+230.0f, y + (h - 20.f) / 2.f, 20.0f, aBuf, -1);
|
||||
TextRender()->Text(0, x+230.0f, y + (h - 20.f) / 2.f, 20.0f, aBuf, -1.0f);
|
||||
}
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj->m_RoundNum && m_pClient->m_Snap.m_pGameInfoObj->m_RoundCurrent)
|
||||
{
|
||||
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);
|
||||
TextRender()->Text(0, x+w-tw-10.0f, y + (h - 20.f) / 2.f, 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.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
}
|
||||
}
|
||||
}
|
||||
TextRender()->Text(0, x + 20.0f, y + (50.f - TitleFontsize) / 2.f, TitleFontsize, pTitle, -1);
|
||||
TextRender()->Text(0, x + 20.0f, y + (50.f - TitleFontsize) / 2.f, TitleFontsize, pTitle, -1.0f);
|
||||
|
||||
if(m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS)
|
||||
{
|
||||
|
@ -252,8 +252,8 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
|
||||
if (!lower16 && !lower32 && !lower24)
|
||||
{
|
||||
tw = TextRender()->TextWidth(0, TitleFontsize, aBuf, -1);
|
||||
TextRender()->Text(0, x+w-tw-20.0f, y + (50.f - TitleFontsize) / 2.f, 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.0f);
|
||||
}
|
||||
|
||||
// calculate measurements
|
||||
|
@ -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,17 +302,17 @@ 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, ScoreOffset+ScoreLength-tw, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, pScore, -1.0f);
|
||||
|
||||
TextRender()->Text(0, NameOffset, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Name"), -1);
|
||||
TextRender()->Text(0, NameOffset, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Name"), -1.0f);
|
||||
|
||||
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Clan"), -1);
|
||||
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("Clan"), -1, -1.0f);
|
||||
TextRender()->Text(0, ClanOffset+ClanLength/2-tw/2, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Clan"), -1.0f);
|
||||
|
||||
tw = TextRender()->TextWidth(0, HeadlineFontsize, Localize("Ping"), -1);
|
||||
TextRender()->Text(0, PingOffset+PingLength-tw, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, 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.0f);
|
||||
|
||||
// render player entries
|
||||
y += HeadlineFontsize*2.0f;
|
||||
|
@ -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();
|
||||
|
@ -584,7 +584,7 @@ void CScoreboard::RenderRecordingNotification(float x)
|
|||
RenderTools()->DrawRoundRect(x+20, 15.0f, 20.0f, 20.0f, 10.0f);
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
TextRender()->Text(0, x+50.0f, (50.f - 20.f) / 2.f, 20.0f, aBuf, -1);
|
||||
TextRender()->Text(0, x+50.0f, (50.f - 20.f) / 2.f, 20.0f, aBuf, -1.0f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -651,8 +651,8 @@ void CScoreboard::OnRender()
|
|||
str_copy(aText, Localize("Blue team wins!"), sizeof(aText));
|
||||
}
|
||||
|
||||
float w = TextRender()->TextWidth(0, 86.0f, aText, -1);
|
||||
TextRender()->Text(0, Width/2-w/2, 39, 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.0f);
|
||||
}
|
||||
|
||||
RenderScoreboard(Width/2-w-5.0f, 150.0f, w, TEAM_RED, pRedClanName ? pRedClanName : Localize("Red team"));
|
||||
|
|
|
@ -306,7 +306,7 @@ void CSpectator::OnRender()
|
|||
Selected = true;
|
||||
}
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Selected?1.0f:0.5f);
|
||||
TextRender()->Text(0, Width/2.0f-(ObjWidth-60.0f), Height/2.0f-280.f + (60.f - BigFontSize) / 2.f, BigFontSize, Localize("Free-View"), -1);
|
||||
TextRender()->Text(0, Width/2.0f-(ObjWidth-60.0f), Height/2.0f-280.f + (60.f - BigFontSize) / 2.f, BigFontSize, Localize("Free-View"), -1.0f);
|
||||
|
||||
if(Client()->State() == IClient::STATE_DEMOPLAYBACK)
|
||||
{
|
||||
|
@ -318,7 +318,7 @@ void CSpectator::OnRender()
|
|||
Selected = true;
|
||||
}
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Selected?1.0f:0.5f);
|
||||
TextRender()->Text(0, Width/2.0f-(ObjWidth-350.0f), Height/2.0f-280.0f + (60.f - BigFontSize) / 2.f, BigFontSize, Localize("Follow"), -1);
|
||||
TextRender()->Text(0, Width/2.0f-(ObjWidth-350.0f), Height/2.0f-280.0f + (60.f - BigFontSize) / 2.f, BigFontSize, Localize("Follow"), -1.0f);
|
||||
}
|
||||
|
||||
float x = -(ObjWidth - 30.0f), y = StartY;
|
||||
|
|
|
@ -201,7 +201,7 @@ void CStatboard::RenderGlobalStats()
|
|||
float tw;
|
||||
int px = 325;
|
||||
|
||||
TextRender()->Text(0, x+10, y-5, 22.0f, Localize("Name"), -1);
|
||||
TextRender()->Text(0, x+10, y-5, 22.0f, Localize("Name"), -1.0f);
|
||||
const char *apHeaders[] = {
|
||||
Localize("Frags"), Localize("Deaths"), Localize("Suicides"),
|
||||
Localize("Ratio"), Localize("Net"), Localize("FPM"),
|
||||
|
@ -213,8 +213,8 @@ 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);
|
||||
TextRender()->Text(0, x+px-tw, y-5, 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.0f);
|
||||
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,23 +295,23 @@ void CStatboard::RenderGlobalStats()
|
|||
// FRAGS
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Frags);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// DEATHS
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Deaths);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// SUICIDES
|
||||
{
|
||||
px += 10;
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Suicides);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// RATIO
|
||||
|
@ -320,45 +320,45 @@ 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);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// NET
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%+d", pStats->m_Frags-pStats->m_Deaths);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// FPM
|
||||
{
|
||||
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);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// SPREE
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_CurrentSpree);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// BEST SPREE
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_BestSpree);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// GRABS
|
||||
if(GameWithFlags)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagGrabs);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
// WEAPONS
|
||||
|
@ -369,16 +369,16 @@ 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);
|
||||
TextRender()->Text(0, x+px-tw/2, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 80;
|
||||
}
|
||||
// FLAGS
|
||||
if(GameWithFlags)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagCaptures);
|
||||
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1);
|
||||
TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, 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.0f);
|
||||
px += 85;
|
||||
}
|
||||
y += LineHeight;
|
||||
|
|
|
@ -442,7 +442,7 @@ void CRenderTools::RenderTeleOverlay(CTeleTile *pTele, int w, int h, float Scale
|
|||
char aBuf[16];
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Index);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||
UI()->TextRender()->Text(0, mx*Scale - 3.f, (my+ToCenterOffset)*Scale, Size*Scale, aBuf, -1);
|
||||
UI()->TextRender()->Text(0, mx*Scale - 3.f, (my+ToCenterOffset)*Scale, Size*Scale, aBuf, -1.0f);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -504,13 +504,13 @@ void CRenderTools::RenderSpeedupOverlay(CSpeedupTile *pSpeedup, int w, int h, fl
|
|||
char aBuf[16];
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Force);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||
UI()->TextRender()->Text(0, mx*Scale, (my+0.5f+ToCenterOffset/2)*Scale, Size*Scale/2.f, aBuf, -1);
|
||||
UI()->TextRender()->Text(0, mx*Scale, (my+0.5f+ToCenterOffset/2)*Scale, Size*Scale/2.f, aBuf, -1.0f);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
if(MaxSpeed)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), "%d", MaxSpeed);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||
UI()->TextRender()->Text(0, mx*Scale, (my+ToCenterOffset/2)*Scale, Size*Scale/2.f, aBuf, -1);
|
||||
UI()->TextRender()->Text(0, mx*Scale, (my+ToCenterOffset/2)*Scale, Size*Scale/2.f, aBuf, -1.0f);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ void CRenderTools::RenderSwitchOverlay(CSwitchTile *pSwitch, int w, int h, float
|
|||
char aBuf[16];
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Index);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||
UI()->TextRender()->Text(0, mx*Scale, (my+ToCenterOffset/2)*Scale, Size*Scale/2.f, aBuf, -1);
|
||||
UI()->TextRender()->Text(0, mx*Scale, (my+ToCenterOffset/2)*Scale, Size*Scale/2.f, aBuf, -1.0f);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
@ -572,7 +572,7 @@ void CRenderTools::RenderSwitchOverlay(CSwitchTile *pSwitch, int w, int h, float
|
|||
char aBuf[16];
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Delay);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||
UI()->TextRender()->Text(0, mx*Scale, (my+0.5f+ToCenterOffset/2)* Scale, Size*Scale/2.f, aBuf, -1);
|
||||
UI()->TextRender()->Text(0, mx*Scale, (my+0.5f+ToCenterOffset/2)* Scale, Size*Scale/2.f, aBuf, -1.0f);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ void CRenderTools::RenderTuneOverlay(CTuneTile *pTune, int w, int h, float Scale
|
|||
char aBuf[16];
|
||||
str_format(aBuf, sizeof(aBuf), "%d", Index);
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha);
|
||||
UI()->TextRender()->Text(0, mx*Scale+11.f, my*Scale+6.f, Size*Scale/1.5f-5.f, aBuf, -1); // numbers shouldn't be too big and in the center of the tile
|
||||
UI()->TextRender()->Text(0, mx*Scale+11.f, my*Scale+6.f, Size*Scale/1.5f-5.f, aBuf, -1.0f); // numbers shouldn't be too big and in the center of the tile
|
||||
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
@ -5765,7 +5765,7 @@ void CEditor::Render()
|
|||
}
|
||||
|
||||
TextRender()->TextColor(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
TextRender()->Text(0, 5.0f, 27.0f, 10.0f, aBuf, -1);
|
||||
TextRender()->Text(0, 5.0f, 27.0f, 10.0f, aBuf, -1.0f);
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ void CLayerTiles::BrushSelecting(CUIRect Rect)
|
|||
m_pEditor->Graphics()->QuadsEnd();
|
||||
char aBuf[16];
|
||||
str_format(aBuf, sizeof(aBuf), "%d,%d", ConvertX(Rect.w), ConvertY(Rect.h));
|
||||
TextRender()->Text(0, Rect.x+3.0f, Rect.y+3.0f, m_pEditor->m_ShowPicker?15.0f:15.0f*m_pEditor->m_WorldZoom, aBuf, -1);
|
||||
TextRender()->Text(0, Rect.x+3.0f, Rect.y+3.0f, m_pEditor->m_ShowPicker?15.0f:15.0f*m_pEditor->m_WorldZoom, aBuf, -1.0f);
|
||||
}
|
||||
|
||||
int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
||||
|
|
Loading…
Reference in a new issue