diff --git a/examples/shapes/shapes_ball_physics.c b/examples/shapes/shapes_ball_physics.c index f01a7c8e1..9aba0cf57 100644 --- a/examples/shapes/shapes_ball_physics.c +++ b/examples/shapes/shapes_ball_physics.c @@ -45,7 +45,8 @@ int main(void) InitWindow(screenWidth, screenHeight, "raylib [shapes] example - ball physics"); - Ball balls[MAX_BALLS] = {{ + Ball *balls = (Ball*)malloc(sizeof(Ball)*MAX_BALLS); + balls[0] = (Ball){ .pos = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f }, .vel = { 200, 200 }, .ppos = { 0 }, @@ -54,7 +55,7 @@ int main(void) .elasticity = 0.9f, .color = BLUE, .grabbed = false - }}; + }; int ballCount = 1; Ball *grabbedBall = NULL; // A pointer to the current ball that is grabbed @@ -214,6 +215,7 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- + free(balls); CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/shapes/shapes_bouncing_ball.png b/examples/shapes/shapes_bouncing_ball.png index 9d98e3a88..a9555b5c7 100644 Binary files a/examples/shapes/shapes_bouncing_ball.png and b/examples/shapes/shapes_bouncing_ball.png differ