Add a timer on the top-right
This commit is contained in:
parent
6acb513619
commit
e27ab237ba
@ -171,6 +171,7 @@ extern "C" void app_Render(App *app) {
|
||||
|
||||
|
||||
settextcolor(RGB(255, 255, 255));
|
||||
setbkcolor(RGB(0, 0, 0));
|
||||
|
||||
// If paused, display a text
|
||||
if (app->paused)
|
||||
@ -181,6 +182,18 @@ extern "C" void app_Render(App *app) {
|
||||
render_DrawTextEx(buf, box2(SCREEN_WIDTH / 2.0 - 10, 50, 20, 100), DT_CENTER | DT_NOCLIP);
|
||||
}
|
||||
|
||||
// Display a Timer
|
||||
if (strcmp(app->current_level, "title.txt") != 0) {
|
||||
char buf[64];
|
||||
snprintf(
|
||||
buf, sizeof(buf),
|
||||
"%02d:%02d.%02d",
|
||||
app->level_playtime.microseconds / 1000 / 1000 / 60,
|
||||
app->level_playtime.microseconds / 1000 / 1000 % 60,
|
||||
app->level_playtime.microseconds / 10000 % 100);
|
||||
render_DrawTextEx(buf, box2(0, 0, SCREEN_WIDTH, TEXTHEIGHT), DT_RIGHT);
|
||||
}
|
||||
|
||||
// Draw UI
|
||||
ui_Render(app->ui);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user