imgui: Displays FPS color based on FPS (#2437)

This commit is contained in:
¥IGA 2025-02-15 14:53:25 +01:00 committed by GitHub
parent 82cacec8eb
commit bdf4a5249d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 0 deletions

View file

@ -259,7 +259,19 @@ void L::DrawAdvanced() {
void L::DrawSimple() {
const float frameRate = DebugState.Framerate;
if (Config::fpsColor()) {
if (frameRate < 10) {
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); // Red
} else if (frameRate >= 10 && frameRate < 20) {
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.5f, 0.0f, 1.0f)); // Orange
} else {
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f)); // White
}
} else {
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f)); // White
}
Text("%d FPS (%.1f ms)", static_cast<int>(std::round(frameRate)), 1000.0f / frameRate);
PopStyleColor();
}
static void LoadSettings(const char* line) {