|
@ -768,24 +768,7 @@ void UnloadFont(Font font) |
|
|
// NOTE: Uses default font |
|
|
// NOTE: Uses default font |
|
|
void DrawFPS(int posX, int posY) |
|
|
void DrawFPS(int posX, int posY) |
|
|
{ |
|
|
{ |
|
|
// NOTE: We are rendering fps every certain time for better viewing on high framerates |
|
|
|
|
|
|
|
|
|
|
|
static int fps = 0; |
|
|
|
|
|
static int counter = 0; |
|
|
|
|
|
static int refreshRate = 20; |
|
|
|
|
|
|
|
|
|
|
|
if (counter < refreshRate) counter++; |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
fps = GetFPS(); |
|
|
|
|
|
refreshRate = fps; |
|
|
|
|
|
counter = 0; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: Find a better way to calculate FPS, maybe calculate the mean of multiple measures? |
|
|
|
|
|
|
|
|
|
|
|
// NOTE: We have rounding errors every frame, so it oscillates a lot |
|
|
|
|
|
DrawText(TextFormat("%2i FPS", fps), posX, posY, 20, LIME); |
|
|
|
|
|
|
|
|
DrawText(TextFormat("%2i FPS", GetFPS()), posX, posY, 20, LIME); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Draw text (using default font) |
|
|
// Draw text (using default font) |
|
|