1717
1818#include <stdlib.h> // Required for: malloc(), free()
1919
20- #define MAX_BUNNIES 50000 // 50K bunnies limit
20+ #define MAX_BUNNIES 80000 // 80K bunnies limit
2121
2222// This is the maximum amount of elements (quads) per batch
2323// NOTE: This value is defined in [rlgl] module and can be changed there
@@ -51,7 +51,9 @@ int main(void)
5151
5252 int bunniesCount = 0 ; // Bunnies counter
5353
54- SetTargetFPS (60 ); // Set our game to run at 60 frames-per-second
54+ bool paused = false;
55+
56+ //SetTargetFPS(60); // Set our game to run at 60 frames-per-second
5557 //--------------------------------------------------------------------------------------
5658
5759 // Main game loop
@@ -67,8 +69,8 @@ int main(void)
6769 if (bunniesCount < MAX_BUNNIES )
6870 {
6971 bunnies [bunniesCount ].position = GetMousePosition ();
70- bunnies [bunniesCount ].speed .x = (float )GetRandomValue (-250 , 250 )/ 60.0f ;
71- bunnies [bunniesCount ].speed .y = (float )GetRandomValue (-250 , 250 )/ 60.0f ;
72+ bunnies [bunniesCount ].speed .x = (float )GetRandomValue (-250 , 250 );
73+ bunnies [bunniesCount ].speed .y = (float )GetRandomValue (-250 , 250 );
7274 bunnies [bunniesCount ].color = (Color ){ GetRandomValue (50 , 240 ),
7375 GetRandomValue (80 , 240 ),
7476 GetRandomValue (100 , 240 ), 255 };
@@ -77,16 +79,21 @@ int main(void)
7779 }
7880 }
7981
80- // Update bunnies
81- for (int i = 0 ; i < bunniesCount ; i ++ )
82+ if (IsKeyPressed (KEY_P )) paused = !paused ;
83+
84+ if (!paused )
8285 {
83- bunnies [i ].position .x += bunnies [i ].speed .x ;
84- bunnies [i ].position .y += bunnies [i ].speed .y ;
86+ // Update bunnies
87+ for (int i = 0 ; i < bunniesCount ; i ++ )
88+ {
89+ bunnies [i ].position .x += bunnies [i ].speed .x * GetFrameTime ();
90+ bunnies [i ].position .y += bunnies [i ].speed .y * GetFrameTime ();
8591
86- if (((bunnies [i ].position .x + (float )texBunny .width /2 ) > GetScreenWidth ()) ||
87- ((bunnies [i ].position .x + (float )texBunny .width /2 ) < 0 )) bunnies [i ].speed .x *= -1 ;
88- if (((bunnies [i ].position .y + (float )texBunny .height /2 ) > GetScreenHeight ()) ||
89- ((bunnies [i ].position .y + (float )texBunny .height /2 - 40 ) < 0 )) bunnies [i ].speed .y *= -1 ;
92+ if (((bunnies [i ].position .x + (float )texBunny .width /2 ) > GetScreenWidth ()) ||
93+ ((bunnies [i ].position .x + (float )texBunny .width /2 ) < 0 )) bunnies [i ].speed .x *= -1 ;
94+ if (((bunnies [i ].position .y + (float )texBunny .height /2 ) > GetScreenHeight ()) ||
95+ ((bunnies [i ].position .y + (float )texBunny .height /2 - 40 ) < 0 )) bunnies [i ].speed .y *= -1 ;
96+ }
9097 }
9198 //----------------------------------------------------------------------------------
9299
0 commit comments