summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeffery Myers <[email protected]>2021-03-24 09:59:05 -0700
committerGitHub <[email protected]>2021-03-24 17:59:05 +0100
commit13f97471a295b2112c73e06ef603b892ee6de555 (patch)
treecb134d172757cedd38260bfa2a9a46001b243621
parentbb73a8089a0b0947fa1c75420ad69ad8285aac76 (diff)
downloadraylib-13f97471a295b2112c73e06ef603b892ee6de555.tar.gz
raylib-13f97471a295b2112c73e06ef603b892ee6de555.zip
Change the color of the FPS display if the FPS is low (orange for <30, red for < 15). (#1676)
Co-authored-by: Jeffery Myers <[email protected]>
-rw-r--r--src/text.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/text.c b/src/text.c
index 4a574908..784cec4a 100644
--- a/src/text.c
+++ b/src/text.c
@@ -817,7 +817,13 @@ void UnloadFont(Font font)
// NOTE: Uses default font
void DrawFPS(int posX, int posY)
{
- DrawText(TextFormat("%2i FPS", GetFPS()), posX, posY, 20, LIME);
+ Color color = LIME; // good fps
+ int fps = GetFPS();
+
+ if (fps < 30 && fps >= 15) color = ORANGE; // warning FPS
+ else if (fps < 15) color = RED; // bad FPS
+
+ DrawText(TextFormat("%2i FPS", GetFPS()), posX, posY, 20, color);
}
// Draw text (using default font)