summaryrefslogtreecommitdiffhomepage
path: root/examples/src/physac
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-20 16:40:30 +0200
committerRay <[email protected]>2019-05-20 16:40:30 +0200
commit3d7d174c70b2d00fd879ade64c5085d4ff34d4aa (patch)
tree3b690948f186f855aa2ee8bab312b3ca28a56200 /examples/src/physac
parent0b56b996bd053ec875c229e9793f7806b666839c (diff)
downloadraylib.com-3d7d174c70b2d00fd879ade64c5085d4ff34d4aa.tar.gz
raylib.com-3d7d174c70b2d00fd879ade64c5085d4ff34d4aa.zip
Review and recompile ALL examples
Diffstat (limited to 'examples/src/physac')
-rw-r--r--examples/src/physac/physics_demo.c20
-rw-r--r--examples/src/physac/physics_friction.c16
-rw-r--r--examples/src/physac/physics_movement.c18
-rw-r--r--examples/src/physac/physics_restitution.c18
-rw-r--r--examples/src/physac/physics_shatter.c14
5 files changed, 43 insertions, 43 deletions
diff --git a/examples/src/physac/physics_demo.c b/examples/src/physac/physics_demo.c
index a92bb9e..421c82a 100644
--- a/examples/src/physac/physics_demo.c
+++ b/examples/src/physac/physics_demo.c
@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s -static /
* -lraylib -lpthread -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm /
* -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
-*
+*
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/
@@ -21,12 +21,12 @@
#define PHYSAC_NO_THREADS
#include "physac.h"
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics demo");
@@ -41,13 +41,13 @@ int main()
// Create floor rectangle physics body
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
- floor->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
+ floor->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
// 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);
+ circle->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
@@ -132,9 +132,9 @@ int main()
}
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
diff --git a/examples/src/physac/physics_friction.c b/examples/src/physac/physics_friction.c
index 337a126..cbb9dc4 100644
--- a/examples/src/physac/physics_friction.c
+++ b/examples/src/physac/physics_friction.c
@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s -static /
* -lraylib -lpthread -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm /
* -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
-*
+*
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/
@@ -21,12 +21,12 @@
#define PHYSAC_NO_THREADS
#include "physac.h"
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics friction");
@@ -65,7 +65,7 @@ int main()
bodyB->dynamicFriction = 1;
SetPhysicsBodyRotation(bodyB, 330*DEG2RAD);
- SetTargetFPS(60);
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
@@ -82,7 +82,7 @@ int main()
bodyA->velocity = (Vector2){ 0, 0 };
bodyA->angularVelocity = 0;
SetPhysicsBodyRotation(bodyA, 30*DEG2RAD);
-
+
bodyB->position = (Vector2){ screenWidth - 35, screenHeight*0.6f };
bodyB->velocity = (Vector2){ 0, 0 };
bodyB->angularVelocity = 0;
@@ -137,9 +137,9 @@ int main()
}
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
diff --git a/examples/src/physac/physics_movement.c b/examples/src/physac/physics_movement.c
index e799eaa..d946811 100644
--- a/examples/src/physac/physics_movement.c
+++ b/examples/src/physac/physics_movement.c
@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s -static /
* -lraylib -lpthread -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm /
* -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
-*
+*
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/
@@ -23,12 +23,12 @@
#define VELOCITY 0.5f
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics movement");
@@ -56,9 +56,9 @@ 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);
+ body->freezeOrient = true; // Constrain body rotation to avoid little collision torque amounts
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
@@ -123,9 +123,9 @@ int main()
}
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
diff --git a/examples/src/physac/physics_restitution.c b/examples/src/physac/physics_restitution.c
index 3231d0c..a701252 100644
--- a/examples/src/physac/physics_restitution.c
+++ b/examples/src/physac/physics_restitution.c
@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s -static /
* -lraylib -lpthread -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm /
* -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
-*
+*
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/
@@ -21,12 +21,12 @@
#define PHYSAC_NO_THREADS
#include "physac.h"
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Physics restitution");
@@ -50,11 +50,11 @@ int main()
circleB->restitution = 0.5f;
PhysicsBody circleC = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.75f, screenHeight/2 }, 30, 10);
circleC->restitution = 1;
-
- SetTargetFPS(60);
// Restitution demo needs a very tiny physics time step for a proper simulation
- SetPhysicsTimeStep(1.0/60.0/100 * 1000);
+ SetPhysicsTimeStep(1.0/60.0/100*1000);
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
@@ -119,9 +119,9 @@ int main()
}
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
diff --git a/examples/src/physac/physics_shatter.c b/examples/src/physac/physics_shatter.c
index 7478522..cbc6522 100644
--- a/examples/src/physac/physics_shatter.c
+++ b/examples/src/physac/physics_shatter.c
@@ -10,7 +10,7 @@
* gcc -o $(NAME_PART).exe $(FILE_NAME) -s -static /
* -lraylib -lpthread -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm /
* -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
-*
+*
* Copyright (c) 2016-2018 Victor Fisac
*
********************************************************************************************/
@@ -21,12 +21,12 @@
#define PHYSAC_NO_THREADS
#include "physac.h"
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const int screenHeight = 450;
SetConfigFlags(FLAG_MSAA_4X_HINT);
InitWindow(screenWidth, screenHeight, "Physac [raylib] - Body shatter");
@@ -43,7 +43,7 @@ int main()
// Create random polygon physics body to shatter
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
- SetTargetFPS(60);
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
@@ -115,9 +115,9 @@ int main()
}
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
ClosePhysics(); // Unitialize physics
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------