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));
|
settextcolor(RGB(255, 255, 255));
|
||||||
|
setbkcolor(RGB(0, 0, 0));
|
||||||
|
|
||||||
// If paused, display a text
|
// If paused, display a text
|
||||||
if (app->paused)
|
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);
|
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
|
// Draw UI
|
||||||
ui_Render(app->ui);
|
ui_Render(app->ui);
|
||||||
}
|
}
|
||||||
|
1
main.cpp
1
main.cpp
@ -63,6 +63,7 @@ int main() {
|
|||||||
app_Render(app);
|
app_Render(app);
|
||||||
|
|
||||||
if (app->debugOn) {
|
if (app->debugOn) {
|
||||||
|
setbkcolor(0);
|
||||||
app_DebugText(app, debugText);
|
app_DebugText(app, debugText);
|
||||||
render_DrawText(10, 10, (const char *)vector_Data(debugText));
|
render_DrawText(10, 10, (const char *)vector_Data(debugText));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user