aboutsummaryrefslogtreecommitdiff
path: root/examples/physics_basic_rigidbody.c
diff options
context:
space:
mode:
authorvictorfisac <victorfisac@gmail.com>2016-05-20 14:03:23 +0200
committervictorfisac <victorfisac@gmail.com>2016-05-20 14:03:23 +0200
commit4f1bee31654dec5f5cea2ac9d291d202df504745 (patch)
tree42a5028ebab3277a8d46bdcf3fea2990e1aa590d /examples/physics_basic_rigidbody.c
parentea7afc8ec835040d84d79ae318f7aebb9f1e189c (diff)
parentdcf5f45f687f2a534286aecd5e6471a0440b0c21 (diff)
downloadraylib-4f1bee31654dec5f5cea2ac9d291d202df504745.tar.gz
raylib-4f1bee31654dec5f5cea2ac9d291d202df504745.zip
Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop
Diffstat (limited to 'examples/physics_basic_rigidbody.c')
-rw-r--r--examples/physics_basic_rigidbody.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/examples/physics_basic_rigidbody.c b/examples/physics_basic_rigidbody.c
index 917813ad..cd09f070 100644
--- a/examples/physics_basic_rigidbody.c
+++ b/examples/physics_basic_rigidbody.c
@@ -30,26 +30,26 @@ int main()
bool isDebug = false;
// Create rectangle physic object
- PhysicObject *rectangle = CreatePhysicObject((Vector2){ screenWidth*0.25f, screenHeight/2 }, 0.0f, (Vector2){ 75, 50 });
+ PhysicObject rectangle = CreatePhysicObject((Vector2){ screenWidth*0.25f, screenHeight/2 }, 0.0f, (Vector2){ 75, 50 });
rectangle->rigidbody.enabled = true; // Enable physic object rigidbody behaviour
rectangle->rigidbody.applyGravity = true;
rectangle->rigidbody.friction = 0.1f;
rectangle->rigidbody.bounciness = 6.0f;
// Create square physic object
- PhysicObject *square = CreatePhysicObject((Vector2){ screenWidth*0.75f, screenHeight/2 }, 0.0f, (Vector2){ 50, 50 });
+ PhysicObject square = CreatePhysicObject((Vector2){ screenWidth*0.75f, screenHeight/2 }, 0.0f, (Vector2){ 50, 50 });
square->rigidbody.enabled = true; // Enable physic object rigidbody behaviour
square->rigidbody.applyGravity = true;
square->rigidbody.friction = 0.1f;
// Create walls physic objects
- PhysicObject *floor = CreatePhysicObject((Vector2){ screenWidth/2, screenHeight*0.95f }, 0.0f, (Vector2){ screenWidth*0.9f, 100 });
- PhysicObject *leftWall = CreatePhysicObject((Vector2){ 0.0f, screenHeight/2 }, 0.0f, (Vector2){ screenWidth*0.1f, screenHeight });
- PhysicObject *rightWall = CreatePhysicObject((Vector2){ screenWidth, screenHeight/2 }, 0.0f, (Vector2){ screenWidth*0.1f, screenHeight });
- PhysicObject *roof = CreatePhysicObject((Vector2){ screenWidth/2, screenHeight*0.05f }, 0.0f, (Vector2){ screenWidth*0.9f, 100 });
+ PhysicObject floor = CreatePhysicObject((Vector2){ screenWidth/2, screenHeight*0.95f }, 0.0f, (Vector2){ screenWidth*0.9f, 100 });
+ PhysicObject leftWall = CreatePhysicObject((Vector2){ 0.0f, screenHeight/2 }, 0.0f, (Vector2){ screenWidth*0.1f, screenHeight });
+ PhysicObject rightWall = CreatePhysicObject((Vector2){ screenWidth, screenHeight/2 }, 0.0f, (Vector2){ screenWidth*0.1f, screenHeight });
+ PhysicObject roof = CreatePhysicObject((Vector2){ screenWidth/2, screenHeight*0.05f }, 0.0f, (Vector2){ screenWidth*0.9f, 100 });
// Create pplatform physic object
- PhysicObject *platform = CreatePhysicObject((Vector2){ screenWidth/2, screenHeight*0.7f }, 0.0f, (Vector2){ screenWidth*0.25f, 20 });
+ PhysicObject platform = CreatePhysicObject((Vector2){ screenWidth/2, screenHeight*0.7f }, 0.0f, (Vector2){ screenWidth*0.25f, 20 });
//--------------------------------------------------------------------------------------
@@ -114,7 +114,8 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
- ClosePhysics(); // Unitialize physics module
+ ClosePhysics(); // Unitialize physics (including all loaded objects)
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------