mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
fixed that scoreboard overlaps the chat. Closes #14
This commit is contained in:
parent
d972e4ed69
commit
1cfa122521
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <game/client/gameclient.h>
|
||||
|
||||
#include <game/client/components/scoreboard.h>
|
||||
#include <game/client/components/sounds.h>
|
||||
#include <game/localization.h>
|
||||
|
||||
|
@ -205,9 +206,10 @@ void CChat::OnRender()
|
|||
|
||||
y -= 8.0f;
|
||||
|
||||
int i;
|
||||
int64 Now = time_get();
|
||||
for(i = 0; i < MAX_LINES; i++)
|
||||
float LineWidth = m_pClient->m_pScoreboard->Active() ? 95.0f : 200.0f;
|
||||
float HeightLimit = m_pClient->m_pScoreboard->Active() ? 220.0f : m_Show ? 50.0f : 200.0f;
|
||||
for(int i = 0; i < MAX_LINES; i++)
|
||||
{
|
||||
int r = ((m_CurrentLine-i)+MAX_LINES)%MAX_LINES;
|
||||
if(Now > m_aLines[r].m_Time+15*time_freq() && !m_Show)
|
||||
|
@ -219,19 +221,18 @@ void CChat::OnRender()
|
|||
// get the y offset
|
||||
CTextCursor Cursor;
|
||||
TextRender()->SetCursor(&Cursor, Begin, 0, FontSize, 0);
|
||||
Cursor.m_LineWidth = 200.0f;
|
||||
Cursor.m_LineWidth = LineWidth;
|
||||
TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1);
|
||||
TextRender()->TextEx(&Cursor, m_aLines[r].m_aText, -1);
|
||||
y -= Cursor.m_Y + Cursor.m_FontSize;
|
||||
|
||||
// cut off if msgs waste too much space
|
||||
float HeightLimit = m_Show ? 0.0f : 200.0f;
|
||||
if(y < HeightLimit)
|
||||
break;
|
||||
|
||||
// reset the cursor
|
||||
TextRender()->SetCursor(&Cursor, Begin, y, FontSize, TEXTFLAG_RENDER);
|
||||
Cursor.m_LineWidth = 200.0f;
|
||||
Cursor.m_LineWidth = LineWidth;
|
||||
|
||||
// render name
|
||||
TextRender()->TextColor(0.8f,0.8f,0.8f,1);
|
||||
|
|
|
@ -322,3 +322,8 @@ void CScoreboard::OnRender()
|
|||
RenderGoals(Width/2-w/2, 150+750+25, w);
|
||||
RenderSpectators(Width/2-w/2, 150+750+25+50+25, w);
|
||||
}
|
||||
|
||||
bool CScoreboard::Active()
|
||||
{
|
||||
return m_Active | (m_pClient->m_Snap.m_pGameobj && m_pClient->m_Snap.m_pGameobj->m_GameOver);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ public:
|
|||
virtual void OnReset();
|
||||
virtual void OnConsoleInit();
|
||||
virtual void OnRender();
|
||||
|
||||
bool Active();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -134,6 +134,7 @@ void CGameClient::OnConsoleInit()
|
|||
m_pDamageind = &::gsDamageInd;
|
||||
m_pMapimages = &::gs_MapImages;
|
||||
m_pVoting = &::gs_Voting;
|
||||
m_pScoreboard = &::gs_Scoreboard;
|
||||
|
||||
// make a list of all the systems, make sure to add them in the corrent render order
|
||||
m_All.Add(m_pSkins);
|
||||
|
|
|
@ -205,6 +205,7 @@ public:
|
|||
class CMotd *m_pMotd;
|
||||
class CMapImages *m_pMapimages;
|
||||
class CVoting *m_pVoting;
|
||||
class CScoreboard *m_pScoreboard;
|
||||
};
|
||||
|
||||
extern const char *Localize(const char *Str);
|
||||
|
|
Loading…
Reference in a new issue