Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/shapes/shapes_ball_physics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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
Expand Down Expand Up @@ -214,6 +215,7 @@ int main(void)

// De-Initialization
//--------------------------------------------------------------------------------------
free(balls);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

Expand Down
Binary file modified examples/shapes/shapes_bouncing_ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading