From 35f095d7c5a644bf82c827513d87c7fc4afc5308 Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Tue, 12 Dec 2023 06:42:40 -0800 Subject: [PATCH] When paused in `simulate`, add index of history scrubber if not 0. PiperOrigin-RevId: 590184966 Change-Id: Id0914c41a1339cf71ebdea02ec486c52c3d37179 --- simulate/simulate.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/simulate/simulate.cc b/simulate/simulate.cc index 0b2a150a..db0821d2 100644 --- a/simulate/simulate.cc +++ b/simulate/simulate.cc @@ -2476,7 +2476,14 @@ void Simulate::Render() { // show pause/loading label if (!this->run || this->loadrequest) { - const char* label = this->loadrequest ? "LOADING..." : "PAUSE"; + char label[30] = {'\0'}; + if (this->loadrequest) { + std::snprintf(label, sizeof(label), "LOADING..."); + } if (this->scrub_index == 0) { + std::snprintf(label, sizeof(label), "PAUSE"); + } else { + std::snprintf(label, sizeof(label), "PAUSE (%d)", this->scrub_index); + } mjr_overlay(mjFONT_BIG, mjGRID_TOP, smallrect, label, nullptr, &this->platform_ui->mjr_context()); }