mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 19:02:19 -05:00
use the convenient printf fomat as ImGui::Text supports it (#2486)
This commit is contained in:
parent
1e6ec1bdda
commit
877fc2dcca
@ -49,22 +49,7 @@ void DisplayTimeHHMMSS(uint32_t timeInTenthsOfSeconds, const char* text, ImVec4
|
||||
|
||||
ImGui::Text(text);
|
||||
ImGui::SameLine();
|
||||
|
||||
// Hack to keep the timers aligned and prevent them from shifting around
|
||||
// Put a leading zero in front of the seconds or minutes if they're less than 10
|
||||
if (mm < 10 && ss < 10) {
|
||||
ImGui::Text("%u:0%u:0%u.%u", hh, mm, ss, ds);
|
||||
}
|
||||
if (mm < 10 && ss >= 10) {
|
||||
ImGui::Text("%u:0%u:%u.%u", hh, mm, ss, ds);
|
||||
}
|
||||
if (mm >= 10 && ss < 10) {
|
||||
ImGui::Text("%u:%u:0%u.%u", hh, mm, ss, ds);
|
||||
}
|
||||
if (mm >= 10 && ss >= 10) {
|
||||
ImGui::Text("%u:%u:%u.%u", hh, mm, ss, ds);
|
||||
}
|
||||
|
||||
ImGui::Text("%2u:%02u:%02u.%u", hh, mm, ss, ds);
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
@ -85,20 +70,7 @@ void DisplayStat(const char* text, uint32_t value) {
|
||||
|
||||
ImGui::Text(text);
|
||||
ImGui::SameLine();
|
||||
// Hack to keep the digits properly aligned in the column
|
||||
if (value < 10) {
|
||||
ImGui::Text(" %u", value);
|
||||
} else if (value < 100) {
|
||||
ImGui::Text(" %u", value);
|
||||
} else if (value < 1000) {
|
||||
ImGui::Text(" %u", value);
|
||||
} else if (value < 10000) {
|
||||
ImGui::Text(" %u", value);
|
||||
} else if (value < 100000) {
|
||||
ImGui::Text(" %u", value);
|
||||
} else {
|
||||
ImGui::Text("%u", value);
|
||||
}
|
||||
ImGui::Text("%7u", value);
|
||||
}
|
||||
|
||||
void DisplayStatIfNonZero(const char* text, uint32_t value) {
|
||||
|
Loading…
Reference in New Issue
Block a user