summaryrefslogtreecommitdiffhomepage
path: root/src/text.c
diff options
context:
space:
mode:
authorRay <[email protected]>2017-01-28 00:56:45 +0100
committerRay <[email protected]>2017-01-28 00:56:45 +0100
commitb681e8c2775bbb467c0f0607afd9840fda25c563 (patch)
tree870326fd3139e0711cb521958042e2bc43b70233 /src/text.c
parent37a64df7b9944d1d24872f07a7e713884b33432e (diff)
downloadraylib-b681e8c2775bbb467c0f0607afd9840fda25c563.tar.gz
raylib-b681e8c2775bbb467c0f0607afd9840fda25c563.zip
Implemented Wait()
Now program is halted (OS signal call) for required amount of time every frame, so CPU usage drops to zero, instead of using a busy wait loop.
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/text.c b/src/text.c
index 4510b3af..4e163668 100644
--- a/src/text.c
+++ b/src/text.c
@@ -504,25 +504,8 @@ Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, float fontSize, i
// NOTE: Uses default font
void DrawFPS(int posX, int posY)
{
- // NOTE: We are rendering fps every second for better viewing on high framerates
- // TODO: Not working properly on ANDROID and RPI (for high framerates)
-
- static float fps = 0.0f;
- static int counter = 0;
- static int refreshRate = 20;
-
- if (counter < refreshRate)
- {
- counter++;
- }
- else
- {
- fps = GetFPS();
- refreshRate = (int)fps;
- counter = 0;
- }
-
- DrawText(FormatText("%2.0f FPS", fps), posX, posY, 20, LIME);
+ // NOTE: We have rounding errors every frame, so it oscillates a lot
+ DrawText(FormatText("%2i FPS", GetFPS()), posX, posY, 20, LIME);
}
//----------------------------------------------------------------------------------