Update textures_bunnymark.c

This commit is contained in:
Ray
2026-03-08 23:00:05 +01:00
parent 99cab6d3a7
commit 32005b9edf

View File

@ -17,7 +17,7 @@
#include <stdlib.h> // Required for: malloc(), free() #include <stdlib.h> // 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 // This is the maximum amount of elements (quads) per batch
// NOTE: This value is defined in [rlgl] module and can be changed there // 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 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 // Main game loop
@ -67,8 +69,8 @@ int main(void)
if (bunniesCount < MAX_BUNNIES) if (bunniesCount < MAX_BUNNIES)
{ {
bunnies[bunniesCount].position = GetMousePosition(); bunnies[bunniesCount].position = GetMousePosition();
bunnies[bunniesCount].speed.x = (float)GetRandomValue(-250, 250)/60.0f; bunnies[bunniesCount].speed.x = (float)GetRandomValue(-250, 250);
bunnies[bunniesCount].speed.y = (float)GetRandomValue(-250, 250)/60.0f; bunnies[bunniesCount].speed.y = (float)GetRandomValue(-250, 250);
bunnies[bunniesCount].color = (Color){ GetRandomValue(50, 240), bunnies[bunniesCount].color = (Color){ GetRandomValue(50, 240),
GetRandomValue(80, 240), GetRandomValue(80, 240),
GetRandomValue(100, 240), 255 }; GetRandomValue(100, 240), 255 };
@ -77,17 +79,22 @@ int main(void)
} }
} }
if (IsKeyPressed(KEY_P)) paused = !paused;
if (!paused)
{
// Update bunnies // Update bunnies
for (int i = 0; i < bunniesCount; i++) for (int i = 0; i < bunniesCount; i++)
{ {
bunnies[i].position.x += bunnies[i].speed.x; bunnies[i].position.x += bunnies[i].speed.x*GetFrameTime();
bunnies[i].position.y += bunnies[i].speed.y; bunnies[i].position.y += bunnies[i].speed.y*GetFrameTime();
if (((bunnies[i].position.x + (float)texBunny.width/2) > GetScreenWidth()) || if (((bunnies[i].position.x + (float)texBunny.width/2) > GetScreenWidth()) ||
((bunnies[i].position.x + (float)texBunny.width/2) < 0)) bunnies[i].speed.x *= -1; ((bunnies[i].position.x + (float)texBunny.width/2) < 0)) bunnies[i].speed.x *= -1;
if (((bunnies[i].position.y + (float)texBunny.height/2) > GetScreenHeight()) || 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; ((bunnies[i].position.y + (float)texBunny.height/2 - 40) < 0)) bunnies[i].speed.y *= -1;
} }
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw