Show server days since starting
This commit is contained in:
parent
27f08661b2
commit
40e3ec1e56
@ -1966,10 +1966,19 @@ void IrrDriver::renderNetworkDebug()
|
|||||||
(int)(0.6f * screen_size.Height));
|
(int)(0.6f * screen_size.Height));
|
||||||
video::SColor color(0x80, 0xFF, 0xFF, 0xFF);
|
video::SColor color(0x80, 0xFF, 0xFF, 0xFF);
|
||||||
GL32_draw2DRectangle(color, background_rect);
|
GL32_draw2DRectangle(color, background_rect);
|
||||||
std::string server_time = StringUtils::timeToString(
|
uint64_t r, d, h, m, s, f;
|
||||||
(float)STKHost::get()->getNetworkTimer() / 1000.0f,
|
r = STKHost::get()->getNetworkTimer();
|
||||||
/*precision*/2, /*display_minutes_if_zero*/true,
|
d = r / 86400000;
|
||||||
/*display_hours*/true);
|
r = r % 86400000;
|
||||||
|
h = r / 3600000;
|
||||||
|
r = r % 3600000;
|
||||||
|
m = r / 60000;
|
||||||
|
r = r % 60000;
|
||||||
|
s = r / 1000;
|
||||||
|
f = r % 1000;
|
||||||
|
char str[128];
|
||||||
|
sprintf(str, "%d day(s), %02d:%02d:%02d.%03d",
|
||||||
|
(int)d, (int)h, (int)m, (int)s, (int)f);
|
||||||
|
|
||||||
gui::IGUIFont* font = GUIEngine::getFont();
|
gui::IGUIFont* font = GUIEngine::getFont();
|
||||||
unsigned height = font->getDimension(L"X").Height + 2;
|
unsigned height = font->getDimension(L"X").Height + 2;
|
||||||
@ -1977,7 +1986,7 @@ void IrrDriver::renderNetworkDebug()
|
|||||||
static video::SColor black = video::SColor(255, 0, 0, 0);
|
static video::SColor black = video::SColor(255, 0, 0, 0);
|
||||||
font->draw(StringUtils::insertValues(
|
font->draw(StringUtils::insertValues(
|
||||||
L"Server time: %s Server state frequency: %d",
|
L"Server time: %s Server state frequency: %d",
|
||||||
server_time.c_str(), NetworkConfig::get()->getStateFrequency()),
|
str, NetworkConfig::get()->getStateFrequency()),
|
||||||
background_rect, black, false);
|
background_rect, black, false);
|
||||||
|
|
||||||
background_rect.UpperLeftCorner.Y += height;
|
background_rect.UpperLeftCorner.Y += height;
|
||||||
|
Loading…
Reference in New Issue
Block a user