From 4b8a0268ede4bd56a7b06fd2e2ea056f933f0f10 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 17 Apr 2017 17:25:27 +0200 Subject: Added physac examples to web Some tweaks on original src files --- examples/physac/physics_demo.c | 4 +++- examples/physac/physics_friction.c | 3 ++- examples/physac/physics_movement.c | 3 ++- examples/physac/physics_restitution.c | 3 ++- examples/physac/physics_shatter.c | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) (limited to 'examples/physac') diff --git a/examples/physac/physics_demo.c b/examples/physac/physics_demo.c index 9bf04d50..1b54d51b 100644 --- a/examples/physac/physics_demo.c +++ b/examples/physac/physics_demo.c @@ -28,7 +28,6 @@ int main() SetConfigFlags(FLAG_MSAA_4X_HINT); InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics demo"); - SetTargetFPS(60); // Physac logo drawing position int logoX = screenWidth - MeasureText("Physac", 30) - 10; @@ -44,6 +43,8 @@ int main() // Create obstacle circle physics body PhysicsBody circle = CreatePhysicsBodyCircle((Vector2){ screenWidth/2, screenHeight/2 }, 45, 10); circle->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions) + + SetTargetFPS(60); //-------------------------------------------------------------------------------------- // Main game loop @@ -120,6 +121,7 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- ClosePhysics(); // Unitialize physics + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- diff --git a/examples/physac/physics_friction.c b/examples/physac/physics_friction.c index 25f31d3f..9472729a 100644 --- a/examples/physac/physics_friction.c +++ b/examples/physac/physics_friction.c @@ -28,7 +28,6 @@ int main() SetConfigFlags(FLAG_MSAA_4X_HINT); InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics friction"); - SetTargetFPS(60); // Physac logo drawing position int logoX = screenWidth - MeasureText("Physac", 30) - 10; @@ -63,6 +62,8 @@ int main() bodyB->staticFriction = 1; bodyB->dynamicFriction = 1; SetPhysicsBodyRotation(bodyB, 330*DEG2RAD); + + SetTargetFPS(60); //-------------------------------------------------------------------------------------- // Main game loop diff --git a/examples/physac/physics_movement.c b/examples/physac/physics_movement.c index f81316ed..4b2c9ab0 100644 --- a/examples/physac/physics_movement.c +++ b/examples/physac/physics_movement.c @@ -30,7 +30,6 @@ int main() SetConfigFlags(FLAG_MSAA_4X_HINT); InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics movement"); - SetTargetFPS(60); // Physac logo drawing position int logoX = screenWidth - MeasureText("Physac", 30) - 10; @@ -56,6 +55,8 @@ int main() // Create movement physics body PhysicsBody body = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight/2 }, 50, 50, 1); body->freezeOrient = true; // Constrain body rotation to avoid little collision torque amounts + + SetTargetFPS(60); //-------------------------------------------------------------------------------------- // Main game loop diff --git a/examples/physac/physics_restitution.c b/examples/physac/physics_restitution.c index d58ec6e3..2be8f42e 100644 --- a/examples/physac/physics_restitution.c +++ b/examples/physac/physics_restitution.c @@ -28,7 +28,6 @@ int main() SetConfigFlags(FLAG_MSAA_4X_HINT); InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics restitution"); - SetTargetFPS(60); // Physac logo drawing position int logoX = screenWidth - MeasureText("Physac", 30) - 10; @@ -49,6 +48,8 @@ int main() circleB->restitution = 0.5f; PhysicsBody circleC = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.75f, screenHeight/2 }, 30, 10); circleC->restitution = 1; + + SetTargetFPS(60); //-------------------------------------------------------------------------------------- // Main game loop diff --git a/examples/physac/physics_shatter.c b/examples/physac/physics_shatter.c index 4e3b0cb6..6b474cd3 100644 --- a/examples/physac/physics_shatter.c +++ b/examples/physac/physics_shatter.c @@ -28,7 +28,6 @@ int main() SetConfigFlags(FLAG_MSAA_4X_HINT); InitWindow(screenWidth, screenHeight, "Physac [raylib] - Body shatter"); - SetTargetFPS(60); // Physac logo drawing position int logoX = screenWidth - MeasureText("Physac", 30) - 10; @@ -40,6 +39,8 @@ int main() // Create random polygon physics body to shatter PhysicsBody body = CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10); + + SetTargetFPS(60); //-------------------------------------------------------------------------------------- // Main game loop -- cgit v1.2.3