mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-01 22:02:18 -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::Text(text);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("%2u:%02u:%02u.%u", hh, mm, ss, ds);
|
||||||
// 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::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,20 +70,7 @@ void DisplayStat(const char* text, uint32_t value) {
|
|||||||
|
|
||||||
ImGui::Text(text);
|
ImGui::Text(text);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
// Hack to keep the digits properly aligned in the column
|
ImGui::Text("%7u", value);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayStatIfNonZero(const char* text, uint32_t value) {
|
void DisplayStatIfNonZero(const char* text, uint32_t value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user