mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add local time screen at top
This commit is contained in:
parent
48d84b2784
commit
58039066f4
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "scoreboard.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <base/tl/string.h>
|
||||
#include <engine/serverbrowser.h>
|
||||
|
||||
|
@ -320,6 +321,27 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
}
|
||||
}
|
||||
|
||||
void CScoreboard::RenderLocalTime(float x)
|
||||
{
|
||||
//draw the box
|
||||
Graphics()->BlendNormal();
|
||||
Graphics()->TextureSet(-1);
|
||||
Graphics()->QuadsBegin();
|
||||
Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.4f);
|
||||
RenderTools()->DrawRoundRectExt(x-120.0f, 0.0f, 100.0f, 50.0f, 15.0f, CUI::CORNER_B);
|
||||
Graphics()->QuadsEnd();
|
||||
|
||||
time_t rawtime;
|
||||
struct tm *timeinfo;
|
||||
time(&rawtime);
|
||||
timeinfo = localtime(&rawtime);
|
||||
|
||||
//draw the text
|
||||
char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), "%02d:%02d", timeinfo->tm_hour, timeinfo->tm_min);
|
||||
TextRender()->Text(0, x-100.0f, 10.0f, 20.0f, aBuf, -1);
|
||||
}
|
||||
|
||||
void CScoreboard::RenderRecordingNotification(float x)
|
||||
{
|
||||
if(!m_pClient->DemoRecorder()->IsRecording())
|
||||
|
@ -404,6 +426,7 @@ void CScoreboard::OnRender()
|
|||
RenderGoals(Width/2-w/2, 150+760+10, w);
|
||||
RenderSpectators(Width/2-w/2, 150+760+10+50+10, w);
|
||||
RenderRecordingNotification((Width/7)*4);
|
||||
RenderLocalTime((Width/7)*3);
|
||||
}
|
||||
|
||||
bool CScoreboard::Active()
|
||||
|
|
|
@ -10,6 +10,7 @@ class CScoreboard : public CComponent
|
|||
void RenderSpectators(float x, float y, float w);
|
||||
void RenderScoreboard(float x, float y, float w, int Team, const char *pTitle);
|
||||
void RenderRecordingNotification(float x);
|
||||
void RenderLocalTime(float x);
|
||||
|
||||
static void ConKeyScoreboard(IConsole::IResult *pResult, void *pUserData);
|
||||
|
||||
|
|
|
@ -2031,6 +2031,8 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
|
|||
if(pSwitch)
|
||||
{
|
||||
Index = pSwitch[y*pTileMap->m_Width + x].m_Type;
|
||||
// TODO: Add off by default door here
|
||||
// if (Index == TILE_DOOR_OFF)
|
||||
if(Index >= ENTITY_OFFSET)
|
||||
{
|
||||
vec2 Pos(x*32.0f+16.0f, y*32.0f+16.0f);
|
||||
|
|
Loading…
Reference in a new issue