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
|
// NOTE: Uses default font
|
||||||
void DrawFPS(int posX, int posY)
|
void DrawFPS(int posX, int posY)
|
||||||
{
|
{
|
||||||
Color color = LIME; // Good FPS
|
const int fps = GetFPS();
|
||||||
int fps = GetFPS();
|
|
||||||
|
|
||||||
if ((fps < 30) && (fps >= 15)) color = ORANGE; // Warning FPS
|
Color color =
|
||||||
else if (fps < 15) color = RED; // Low FPS
|
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)
|
// Draw text (using default font)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user