From 32005b9edf7cf8d9d7dc2c0aea9c3221b71f30c5 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 8 Mar 2026 23:00:05 +0100 Subject: [PATCH] Update textures_bunnymark.c --- examples/textures/textures_bunnymark.c | 33 ++++++++++++++++---------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/examples/textures/textures_bunnymark.c b/examples/textures/textures_bunnymark.c index 3279abb8f..a04741227 100644 --- a/examples/textures/textures_bunnymark.c +++ b/examples/textures/textures_bunnymark.c @@ -17,7 +17,7 @@ #include // Required for: malloc(), free() -#define MAX_BUNNIES 50000 // 50K bunnies limit +#define MAX_BUNNIES 80000 // 80K bunnies limit // This is the maximum amount of elements (quads) per batch // NOTE: This value is defined in [rlgl] module and can be changed there @@ -51,7 +51,9 @@ int main(void) int bunniesCount = 0; // Bunnies counter - SetTargetFPS(60); // Set our game to run at 60 frames-per-second + bool paused = false; + + //SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop @@ -67,8 +69,8 @@ int main(void) if (bunniesCount < MAX_BUNNIES) { bunnies[bunniesCount].position = GetMousePosition(); - bunnies[bunniesCount].speed.x = (float)GetRandomValue(-250, 250)/60.0f; - bunnies[bunniesCount].speed.y = (float)GetRandomValue(-250, 250)/60.0f; + bunnies[bunniesCount].speed.x = (float)GetRandomValue(-250, 250); + bunnies[bunniesCount].speed.y = (float)GetRandomValue(-250, 250); bunnies[bunniesCount].color = (Color){ GetRandomValue(50, 240), GetRandomValue(80, 240), GetRandomValue(100, 240), 255 }; @@ -77,16 +79,21 @@ int main(void) } } - // Update bunnies - for (int i = 0; i < bunniesCount; i++) - { - bunnies[i].position.x += bunnies[i].speed.x; - bunnies[i].position.y += bunnies[i].speed.y; + if (IsKeyPressed(KEY_P)) paused = !paused; - if (((bunnies[i].position.x + (float)texBunny.width/2) > GetScreenWidth()) || - ((bunnies[i].position.x + (float)texBunny.width/2) < 0)) bunnies[i].speed.x *= -1; - if (((bunnies[i].position.y + (float)texBunny.height/2) > GetScreenHeight()) || - ((bunnies[i].position.y + (float)texBunny.height/2 - 40) < 0)) bunnies[i].speed.y *= -1; + if (!paused) + { + // Update bunnies + for (int i = 0; i < bunniesCount; i++) + { + bunnies[i].position.x += bunnies[i].speed.x*GetFrameTime(); + bunnies[i].position.y += bunnies[i].speed.y*GetFrameTime(); + + if (((bunnies[i].position.x + (float)texBunny.width/2) > GetScreenWidth()) || + ((bunnies[i].position.x + (float)texBunny.width/2) < 0)) bunnies[i].speed.x *= -1; + if (((bunnies[i].position.y + (float)texBunny.height/2) > GetScreenHeight()) || + ((bunnies[i].position.y + (float)texBunny.height/2 - 40) < 0)) bunnies[i].speed.y *= -1; + } } //----------------------------------------------------------------------------------