mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Merge pull request #1893 from Dune-jr/feature-ready-notification
Notify players which key they should press to set themselves ready
This commit is contained in:
commit
c92f044f39
|
@ -84,6 +84,7 @@ void CHud::RenderPauseTimer()
|
|||
str_format(aBuf, sizeof(aBuf), Localize("%d players not ready"), m_pClient->m_Snap.m_NotReadyCount);
|
||||
else
|
||||
return;
|
||||
RenderReadyUpNotification();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -344,9 +345,15 @@ void CHud::RenderWarmupTimer()
|
|||
if(m_pClient->m_Snap.m_pGameData->m_GameStateEndTick == 0)
|
||||
{
|
||||
if(m_pClient->m_Snap.m_NotReadyCount == 1)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), Localize("%d player not ready"), m_pClient->m_Snap.m_NotReadyCount);
|
||||
RenderReadyUpNotification();
|
||||
}
|
||||
else if(m_pClient->m_Snap.m_NotReadyCount > 1)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), Localize("%d players not ready"), m_pClient->m_Snap.m_NotReadyCount);
|
||||
RenderReadyUpNotification();
|
||||
}
|
||||
else
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), Localize("wait for more players"));
|
||||
|
@ -674,6 +681,19 @@ void CHud::RenderSpectatorNotification()
|
|||
}
|
||||
}
|
||||
|
||||
void CHud::RenderReadyUpNotification()
|
||||
{
|
||||
if(!(m_pClient->m_Snap.m_paPlayerInfos[m_pClient->m_LocalClientID]->m_PlayerFlags&PLAYERFLAG_READY))
|
||||
{
|
||||
char aKey[64], aText[128];
|
||||
m_pClient->m_pBinds->GetKey("ready_change", aKey, sizeof(aKey));
|
||||
str_format(aText, sizeof(aText), Localize("When ready, press <%s>"), aKey);
|
||||
float FontSize = 16.0f;
|
||||
float w = TextRender()->TextWidth(0, FontSize, aText, -1);
|
||||
TextRender()->Text(0, 150 * Graphics()->ScreenAspect() + -w / 2, 30, FontSize, aText, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void CHud::OnRender()
|
||||
{
|
||||
if(!m_pClient->m_Snap.m_pGameData)
|
||||
|
|
|
@ -26,6 +26,7 @@ class CHud : public CComponent
|
|||
void RenderScoreHud();
|
||||
void RenderSpectatorHud();
|
||||
void RenderSpectatorNotification();
|
||||
void RenderReadyUpNotification();
|
||||
void RenderWarmupTimer();
|
||||
public:
|
||||
CHud();
|
||||
|
|
Loading…
Reference in a new issue