Backported fix for Text() incorrect parameter type (int -> float)

The original fix was done by @oy for 0.7.4.
This commit is contained in:
Fireball 2020-07-15 20:42:48 +01:00
parent b1c17c3248
commit ab9b96ddb2
16 changed files with 83 additions and 83 deletions

View file

@ -737,11 +737,11 @@ public:
pCursor->m_CharCount = 0; 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; CTextCursor Cursor;
SetCursor(&Cursor, x, y, Size, TEXTFLAG_RENDER); SetCursor(&Cursor, x, y, Size, TEXTFLAG_RENDER);
Cursor.m_LineWidth = MaxWidth; Cursor.m_LineWidth = LineWidth;
TextEx(&Cursor, pText, -1); TextEx(&Cursor, pText, -1);
} }

View file

@ -107,7 +107,7 @@ public:
virtual void TextColor(float r, float g, float b, float a) = 0; virtual void TextColor(float r, float g, float b, float a) = 0;
virtual void TextColor(ColorRGBA rgb) = 0; virtual void TextColor(ColorRGBA rgb) = 0;
virtual void TextOutlineColor(float r, float g, float b, float a) = 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 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 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 int TextLineCount(void *pFontSetV, float Size, const char *pText, float LineWidth) = 0;

View file

@ -707,12 +707,12 @@ void CGameConsole::OnRender()
char aBuf[128]; char aBuf[128];
TextRender()->TextColor(1,1,1,1); TextRender()->TextColor(1,1,1,1);
str_format(aBuf, sizeof(aBuf), Localize("-Page %d-"), pConsole->m_BacklogActPage+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 // render version
str_format(aBuf, sizeof(aBuf), "v%s", GAME_VERSION); str_format(aBuf, sizeof(aBuf), "v%s", GAME_VERSION);
float Width = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); float Width = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
TextRender()->Text(0, Screen.w-Width-10.0f, FontSize / 2.f, FontSize, aBuf, -1); TextRender()->Text(0, Screen.w-Width-10.0f, FontSize / 2.f, FontSize, aBuf, -1.0f);
} }
} }

View file

@ -38,40 +38,40 @@ void CDebugHud::RenderNetCorrections()
float x = Width-100.0f, y = 50.0f; float x = Width-100.0f, y = 50.0f;
for(int i = 0; i < Num; ++i) 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; x = Width-10.0f;
char aBuf[128]; char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed/32); str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed/32);
float w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f); float w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1); TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
y += LineHeight; y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed/32*Ramp); str_format(aBuf, sizeof(aBuf), "%.0f", Velspeed/32*Ramp);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f); w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1); TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
y += LineHeight; y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%.2f", Ramp); str_format(aBuf, sizeof(aBuf), "%.2f", Ramp);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f); w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1); TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
y += 2*LineHeight; y += 2*LineHeight;
str_format(aBuf, sizeof(aBuf), "%.2f", static_cast<float>(m_pClient->m_Snap.m_pLocalCharacter->m_X)/32.0f); 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, -1.0f); w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1); TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
y += LineHeight; y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%.2f", static_cast<float>(m_pClient->m_Snap.m_pLocalCharacter->m_Y)/32.0f); 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, -1.0f); w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1); TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
y += LineHeight; y += LineHeight;
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_Snap.m_pLocalCharacter->m_Angle); str_format(aBuf, sizeof(aBuf), "%d", m_pClient->m_Snap.m_pLocalCharacter->m_Angle);
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f); w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1); TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
y += 2*LineHeight; y += 2*LineHeight;
str_format(aBuf, sizeof(aBuf), "%d", m_pClient->NetobjNumCorrections()); str_format(aBuf, sizeof(aBuf), "%d", m_pClient->NetobjNumCorrections());
w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f); w = TextRender()->TextWidth(0, Fontsize, aBuf, -1, -1.0f);
TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1); TextRender()->Text(0, x-w, y, Fontsize, aBuf, -1.0f);
y += LineHeight; y += LineHeight;
w = TextRender()->TextWidth(0, Fontsize, m_pClient->NetobjCorrectedOn(), -1, -1.0f); w = TextRender()->TextWidth(0, Fontsize, m_pClient->NetobjCorrectedOn(), -1, -1.0f);
TextRender()->Text(0, x-w, y, Fontsize, m_pClient->NetobjCorrectedOn(), -1); TextRender()->Text(0, x-w, y, Fontsize, m_pClient->NetobjCorrectedOn(), -1.0f);
} }
void CDebugHud::RenderTuning() void CDebugHud::RenderTuning()
@ -104,15 +104,15 @@ void CDebugHud::RenderTuning()
str_format(aBuf, sizeof(aBuf), "%.2f", Standard); str_format(aBuf, sizeof(aBuf), "%.2f", Standard);
x += 20.0f; x += 20.0f;
w = TextRender()->TextWidth(0, 5, aBuf, -1, -1.0f); w = TextRender()->TextWidth(0, 5, aBuf, -1, -1.0f);
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1); TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1.0f);
str_format(aBuf, sizeof(aBuf), "%.2f", Current); str_format(aBuf, sizeof(aBuf), "%.2f", Current);
x += 20.0f; x += 20.0f;
w = TextRender()->TextWidth(0, 5, aBuf, -1, -1.0f); w = TextRender()->TextWidth(0, 5, aBuf, -1, -1.0f);
TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1); TextRender()->Text(0x0, x-w, y+Count*6, 5, aBuf, -1.0f);
x += 5.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++; Count++;
} }

View file

@ -143,7 +143,7 @@ void CHud::RenderGameTimer()
float Alpha = Time <= 10 && (2*time()/time_freq()) % 2 ? 0.5f : 1.0f; float Alpha = Time <= 10 && (2*time()/time_freq()) % 2 ? 0.5f : 1.0f;
TextRender()->TextColor(1.0f, 0.25f, 0.25f, Alpha); 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); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
} }
} }
@ -156,7 +156,7 @@ void CHud::RenderPauseNotification()
const char *pText = Localize("Game paused"); const char *pText = Localize("Game paused");
float FontSize = 20.0f; float FontSize = 20.0f;
float w = TextRender()->TextWidth(0, FontSize,pText, -1, -1.0f); 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); TextRender()->Text(0, 150.0f*Graphics()->ScreenAspect()+-w/2.0f, 50.0f, FontSize, pText, -1.0f);
} }
} }
@ -168,7 +168,7 @@ void CHud::RenderSuddenDeath()
const char *pText = Localize("Sudden Death"); const char *pText = Localize("Sudden Death");
float FontSize = 12.0f; float FontSize = 12.0f;
float w = TextRender()->TextWidth(0, FontSize, pText, -1, -1.0f); float w = TextRender()->TextWidth(0, FontSize, pText, -1, -1.0f);
TextRender()->Text(0, Half-w/2, 2, FontSize, pText, -1); TextRender()->Text(0, Half-w/2, 2, FontSize, pText, -1.0f);
} }
} }
@ -500,7 +500,7 @@ void CHud::RenderWarmupTimer()
char Buf[256]; char Buf[256];
float FontSize = 20.0f; float FontSize = 20.0f;
float w = TextRender()->TextWidth(0, FontSize, Localize("Warmup"), -1, -1.0f); float w = TextRender()->TextWidth(0, FontSize, Localize("Warmup"), -1, -1.0f);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 50, FontSize, Localize("Warmup"), -1); 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; int Seconds = m_pClient->m_Snap.m_pGameInfoObj->m_WarmupTimer/SERVER_TICK_SPEED;
if(Seconds < 5) if(Seconds < 5)
@ -508,7 +508,7 @@ void CHud::RenderWarmupTimer()
else else
str_format(Buf, sizeof(Buf), "%d", Seconds); str_format(Buf, sizeof(Buf), "%d", Seconds);
w = TextRender()->TextWidth(0, FontSize, Buf, -1, -1.0f); w = TextRender()->TextWidth(0, FontSize, Buf, -1, -1.0f);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, Buf, -1); TextRender()->Text(0, 150*Graphics()->ScreenAspect()+-w/2, 75, FontSize, Buf, -1.0f);
} }
} }
@ -540,7 +540,7 @@ void CHud::RenderTextInfo()
int DigitIndex = (int)log10((FrameTime ? FrameTime : 1)); int DigitIndex = (int)log10((FrameTime ? FrameTime : 1));
if(DigitIndex > 4) if(DigitIndex > 4)
DigitIndex = 4; DigitIndex = 4;
//TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,Buf,-1,-1.0f), 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; CTextCursor Cursor;
TextRender()->SetCursor(&Cursor, m_Width - 10 - s_TextWidth[DigitIndex], 5, 12, TEXTFLAG_RENDER); TextRender()->SetCursor(&Cursor, m_Width - 10 - s_TextWidth[DigitIndex], 5, 12, TEXTFLAG_RENDER);
@ -564,7 +564,7 @@ void CHud::RenderTextInfo()
{ {
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%d", Client()->GetPredictionTime()); str_format(aBuf, sizeof(aBuf), "%d", Client()->GetPredictionTime());
TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,aBuf,-1,-1.0f), 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);
} }
} }
@ -574,7 +574,7 @@ void CHud::RenderConnectionWarning()
{ {
const char *pText = Localize("Connection Problems..."); const char *pText = Localize("Connection Problems...");
float w = TextRender()->TextWidth(0, 24, pText, -1, -1.0f); float w = TextRender()->TextWidth(0, 24, pText, -1, -1.0f);
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-w/2, 50, 24, pText, -1); 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); TextRender()->TextColor(1,1,0.5f,1);
else else
TextRender()->TextColor(0.7f,0.7f,0.2f,1.0f); 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); TextRender()->TextColor(1,1,1,1);
} }
} }
@ -740,7 +740,7 @@ void CHud::RenderSpectatorHud()
char aBuf[128]; char aBuf[128];
str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Spectate"), m_pClient->m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW ? 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")); 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) void CHud::RenderLocalTime(float x)
@ -759,7 +759,7 @@ void CHud::RenderLocalTime(float x)
//draw the text //draw the text
char aTimeStr[6]; char aTimeStr[6];
str_timestamp_format(aTimeStr, sizeof(aTimeStr), "%H:%M"); 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() void CHud::OnRender()
@ -894,7 +894,7 @@ void CHud::RenderDDRaceEffects()
if(m_FinishTime) 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); 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, -1.0f)/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)) 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 TextRender()->TextColor(0.5f,1.0f,0.5f,a); // green
else if(!m_CheckpointDiff) else if(!m_CheckpointDiff)
TextRender()->TextColor(1,1,1,a); // white TextRender()->TextColor(1,1,1,a); // white
TextRender()->Text(0, 150*Graphics()->ScreenAspect()-TextRender()->TextWidth(0, 10, aBuf, -1, -1.0f)/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); TextRender()->TextColor(1,1,1,1);
} }
@ -922,7 +922,7 @@ void CHud::RenderDDRaceEffects()
/*else if(m_DDRaceTimeReceived) /*else if(m_DDRaceTimeReceived)
{ {
str_format(aBuf, sizeof(aBuf), "%02d:%02d.%d", m_DDRaceTime/60, m_DDRaceTime%60, m_DDRaceTick/10); 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, -1.0f)/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]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), Localize("Server best:")); 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)); 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]; const float PlayerRecord = m_PlayerRecord[g_Config.m_ClDummy];
@ -942,8 +942,8 @@ void CHud::RenderRecord()
{ {
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), Localize("Personal best:")); 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)); 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);
} }
} }

View file

@ -241,7 +241,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView)
char aSpeedBuf[256]; char aSpeedBuf[256];
str_format(aSpeedBuf, sizeof(aSpeedBuf), "×%.2f", pInfo->m_Speed); 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) if(!m_MenuActive)

View file

@ -391,7 +391,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
x = 5.0f; x = 5.0f;
y = 0.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; y += 32.0f+5.0f;
mem_zero(aBuf, sizeof(aBuf)); mem_zero(aBuf, sizeof(aBuf));
@ -410,7 +410,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
Localize("Password"), CurrentServerInfo.m_Flags &1 ? Localize("Yes") : Localize("No") 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; CUIRect Button;
@ -435,7 +435,7 @@ void CMenus::RenderServerInfo(CUIRect MainView)
x = 5.0f; x = 5.0f;
y = 0.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; y += 32.0f+5.0f;
if(m_pClient->m_Snap.m_pGameInfoObj) 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("Time limit"), m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit,
Localize("Players"), m_pClient->m_Snap.m_NumPlayers, CurrentServerInfo.m_MaxClients 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 // motd
@ -466,9 +466,9 @@ void CMenus::RenderServerInfo(CUIRect MainView)
Motd.Margin(5.0f, &Motd); Motd.Margin(5.0f, &Motd);
y = 0.0f; y = 0.0f;
x = 5.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; 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) bool CMenus::RenderServerControlServer(CUIRect MainView)

View file

@ -787,7 +787,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
RenderTools()->DrawUIRect(&MovementSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f); RenderTools()->DrawUIRect(&MovementSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
MovementSettings.VMargin(10.0f, &MovementSettings); 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); 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); RenderTools()->DrawUIRect(&WeaponSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
WeaponSettings.VMargin(10.0f, &WeaponSettings); 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); WeaponSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &WeaponSettings);
UiDoGetButtons(18, 25, WeaponSettings, MainView); 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); RenderTools()->DrawUIRect(&VotingSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
VotingSettings.VMargin(10.0f, &VotingSettings); 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); VotingSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &VotingSettings);
UiDoGetButtons(25, 27, VotingSettings, MainView); 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); RenderTools()->DrawUIRect(&ChatSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
ChatSettings.VMargin(10.0f, &ChatSettings); 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); ChatSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &ChatSettings);
UiDoGetButtons(27, 31, ChatSettings, MainView); 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); RenderTools()->DrawUIRect(&MiscSettings, ColorRGBA(1,1,1,0.25f), CUI::CORNER_ALL, 10.0f);
MiscSettings.VMargin(10.0f, &MiscSettings); 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); MiscSettings.HSplitTop(14.0f+5.0f+10.0f, 0, &MiscSettings);
UiDoGetButtons(31, 43, MiscSettings, MainView); UiDoGetButtons(31, 43, MiscSettings, MainView);

View file

@ -49,7 +49,7 @@ void CMotd::OnRender()
RenderTools()->DrawRoundRect(x, y, w, h, 40.0f); RenderTools()->DrawRoundRect(x, y, w, h, 40.0f);
Graphics()->QuadsEnd(); 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) void CMotd::OnMessage(int MsgType, void *pRawMsg)

View file

@ -151,7 +151,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
float Offset = g_Config.m_ClNameplatesClan ? (FontSize * 2 + FontSizeClan) : (FontSize * 2); float Offset = g_Config.m_ClNameplatesClan ? (FontSize * 2 + FontSizeClan) : (FontSize * 2);
float tw_id = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); float tw_id = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f);
TextRender()->TextColor(rgb); 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); TextRender()->TextColor(1,1,1,1);

View file

@ -77,20 +77,20 @@ void CScoreboard::RenderGoals(float x, float y, float w)
{ {
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%s: %d", Localize("Score limit"), m_pClient->m_Snap.m_pGameInfoObj->m_ScoreLimit); 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) if(m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit)
{ {
char aBuf[64]; char aBuf[64];
str_format(aBuf, sizeof(aBuf), Localize("Time limit: %d min"), m_pClient->m_Snap.m_pGameInfoObj->m_TimeLimit); 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) if(m_pClient->m_Snap.m_pGameInfoObj->m_RoundNum && m_pClient->m_Snap.m_pGameInfoObj->m_RoundCurrent)
{ {
char aBuf[64]; 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); 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, -1.0f); 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); 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) if(m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS)
{ {
@ -253,7 +253,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
if (!lower16 && !lower32 && !lower24) if (!lower16 && !lower32 && !lower24)
{ {
tw = TextRender()->TextWidth(0, TitleFontsize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x+w-tw-20.0f, y + (50.f - TitleFontsize) / 2.f, TitleFontsize, aBuf, -1.0f);
} }
// calculate measurements // calculate measurements
@ -304,15 +304,15 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
const char *pScore = (m_pClient->m_GameInfo.m_TimeScore && g_Config.m_ClDDRaceScoreBoard) ? Localize("Time") : Localize("Score"); 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, -1.0f); float ScoreWidth = TextRender()->TextWidth(0, HeadlineFontsize, pScore, -1, -1.0f);
tw = ScoreLength > ScoreWidth ? ScoreLength : ScoreWidth; 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, -1.0f); 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); 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, -1.0f); 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); TextRender()->Text(0, PingOffset+PingLength-tw, y + (HeadlineFontsize * 2.f - HeadlineFontsize) / 2.f, HeadlineFontsize, Localize("Ping"), -1.0f);
// render player entries // render player entries
y += HeadlineFontsize*2.0f; y += HeadlineFontsize*2.0f;
@ -584,7 +584,7 @@ void CScoreboard::RenderRecordingNotification(float x)
RenderTools()->DrawRoundRect(x+20, 15.0f, 20.0f, 20.0f, 10.0f); RenderTools()->DrawRoundRect(x+20, 15.0f, 20.0f, 20.0f, 10.0f);
Graphics()->QuadsEnd(); 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);
} }
@ -652,7 +652,7 @@ void CScoreboard::OnRender()
} }
float w = TextRender()->TextWidth(0, 86.0f, aText, -1, -1.0f); float w = TextRender()->TextWidth(0, 86.0f, aText, -1, -1.0f);
TextRender()->Text(0, Width/2-w/2, 39, 86.0f, aText, -1); 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")); RenderScoreboard(Width/2-w-5.0f, 150.0f, w, TEAM_RED, pRedClanName ? pRedClanName : Localize("Red team"));

View file

@ -306,7 +306,7 @@ void CSpectator::OnRender()
Selected = true; Selected = true;
} }
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Selected?1.0f:0.5f); 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) if(Client()->State() == IClient::STATE_DEMOPLAYBACK)
{ {
@ -318,7 +318,7 @@ void CSpectator::OnRender()
Selected = true; Selected = true;
} }
TextRender()->TextColor(1.0f, 1.0f, 1.0f, Selected?1.0f:0.5f); 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; float x = -(ObjWidth - 30.0f), y = StartY;

View file

@ -201,7 +201,7 @@ void CStatboard::RenderGlobalStats()
float tw; float tw;
int px = 325; 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[] = { const char *apHeaders[] = {
Localize("Frags"), Localize("Deaths"), Localize("Suicides"), Localize("Frags"), Localize("Deaths"), Localize("Suicides"),
Localize("Ratio"), Localize("Net"), Localize("FPM"), Localize("Ratio"), Localize("Net"), Localize("FPM"),
@ -214,7 +214,7 @@ void CStatboard::RenderGlobalStats()
if(i == 8 && !GameWithFlags) // Don't draw "Grabs" in game with no flag if(i == 8 && !GameWithFlags) // Don't draw "Grabs" in game with no flag
continue; continue;
tw = TextRender()->TextWidth(0, 22.0f, apHeaders[i], -1, -1.0f); tw = TextRender()->TextWidth(0, 22.0f, apHeaders[i], -1, -1.0f);
TextRender()->Text(0, x+px-tw, y-5, 22.0f, apHeaders[i], -1); TextRender()->Text(0, x+px-tw, y-5, 22.0f, apHeaders[i], -1.0f);
px += 85; px += 85;
} }
@ -296,14 +296,14 @@ void CStatboard::RenderGlobalStats()
{ {
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Frags); str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Frags);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// DEATHS // DEATHS
{ {
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Deaths); str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Deaths);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// SUICIDES // SUICIDES
@ -311,7 +311,7 @@ void CStatboard::RenderGlobalStats()
px += 10; px += 10;
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Suicides); str_format(aBuf, sizeof(aBuf), "%d", pStats->m_Suicides);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// RATIO // RATIO
@ -321,14 +321,14 @@ void CStatboard::RenderGlobalStats()
else else
str_format(aBuf, sizeof(aBuf), "%.2f", (float)(pStats->m_Frags)/pStats->m_Deaths); str_format(aBuf, sizeof(aBuf), "%.2f", (float)(pStats->m_Frags)/pStats->m_Deaths);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// NET // NET
{ {
str_format(aBuf, sizeof(aBuf), "%+d", pStats->m_Frags-pStats->m_Deaths); str_format(aBuf, sizeof(aBuf), "%+d", pStats->m_Frags-pStats->m_Deaths);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// FPM // FPM
@ -336,21 +336,21 @@ void CStatboard::RenderGlobalStats()
float Fpm = pStats->GetFPM(Client()->GameTick(g_Config.m_ClDummy), Client()->GameTickSpeed()); float Fpm = pStats->GetFPM(Client()->GameTick(g_Config.m_ClDummy), Client()->GameTickSpeed());
str_format(aBuf, sizeof(aBuf), "%.1f", Fpm); str_format(aBuf, sizeof(aBuf), "%.1f", Fpm);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// SPREE // SPREE
{ {
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_CurrentSpree); str_format(aBuf, sizeof(aBuf), "%d", pStats->m_CurrentSpree);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// BEST SPREE // BEST SPREE
{ {
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_BestSpree); str_format(aBuf, sizeof(aBuf), "%d", pStats->m_BestSpree);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// GRABS // GRABS
@ -358,7 +358,7 @@ void CStatboard::RenderGlobalStats()
{ {
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagGrabs); str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagGrabs);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
// WEAPONS // WEAPONS
@ -370,7 +370,7 @@ void CStatboard::RenderGlobalStats()
str_format(aBuf, sizeof(aBuf), "%d/%d", pStats->m_aFragsWith[i], pStats->m_aDeathsFrom[i]); str_format(aBuf, sizeof(aBuf), "%d/%d", pStats->m_aFragsWith[i], pStats->m_aDeathsFrom[i]);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x+px-tw/2, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 80; px += 80;
} }
// FLAGS // FLAGS
@ -378,7 +378,7 @@ void CStatboard::RenderGlobalStats()
{ {
str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagCaptures); str_format(aBuf, sizeof(aBuf), "%d", pStats->m_FlagCaptures);
tw = TextRender()->TextWidth(0, FontSize, aBuf, -1, -1.0f); 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); TextRender()->Text(0, x-tw+px, y + (LineHeight*0.95f - FontSize) / 2.f, FontSize, aBuf, -1.0f);
px += 85; px += 85;
} }
y += LineHeight; y += LineHeight;

View file

@ -442,7 +442,7 @@ void CRenderTools::RenderTeleOverlay(CTeleTile *pTele, int w, int h, float Scale
char aBuf[16]; char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Index); str_format(aBuf, sizeof(aBuf), "%d", Index);
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha); 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); 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]; char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Force); str_format(aBuf, sizeof(aBuf), "%d", Force);
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha); 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); UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
if(MaxSpeed) if(MaxSpeed)
{ {
str_format(aBuf, sizeof(aBuf), "%d", MaxSpeed); str_format(aBuf, sizeof(aBuf), "%d", MaxSpeed);
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha); 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); 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]; char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Index); str_format(aBuf, sizeof(aBuf), "%d", Index);
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha); 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); 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]; char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Delay); str_format(aBuf, sizeof(aBuf), "%d", Delay);
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha); 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); 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]; char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Index); str_format(aBuf, sizeof(aBuf), "%d", Index);
UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, Alpha); 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); UI()->TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
} }
} }

View file

@ -5765,7 +5765,7 @@ void CEditor::Render()
} }
TextRender()->TextColor(1.0f, 0.0f, 0.0f, 1.0f); 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); TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
} }

View file

@ -191,7 +191,7 @@ void CLayerTiles::BrushSelecting(CUIRect Rect)
m_pEditor->Graphics()->QuadsEnd(); m_pEditor->Graphics()->QuadsEnd();
char aBuf[16]; char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d,%d", ConvertX(Rect.w), ConvertY(Rect.h)); 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) int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)