DrawFPS - acquire FPS only once per call
This commit is contained in:
parent
c104a97590
commit
9c057b834f
11
src/rtext.c
11
src/rtext.c
|
|
@ -1069,13 +1069,14 @@ bool ExportFontAsCode(Font font, const char *fileName)
|
|||
// NOTE: Uses default font
|
||||
void DrawFPS(int posX, int posY)
|
||||
{
|
||||
Color color = LIME; // Good FPS
|
||||
int fps = GetFPS();
|
||||
const int fps = GetFPS();
|
||||
|
||||
if ((fps < 30) && (fps >= 15)) color = ORANGE; // Warning FPS
|
||||
else if (fps < 15) color = RED; // Low FPS
|
||||
Color color =
|
||||
fps < 15 ? RED : // Low FPS
|
||||
fps < 30 ? ORANGE : // Warning FPS
|
||||
LIME; // Good FPS
|
||||
|
||||
DrawText(TextFormat("%2i FPS", GetFPS()), posX, posY, 20, color);
|
||||
DrawText(TextFormat("%2i FPS", fps), posX, posY, 20, color);
|
||||
}
|
||||
|
||||
// Draw text (using default font)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user