summaryrefslogtreecommitdiffhomepage
path: root/examples/web/physac/physics_friction.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/web/physac/physics_friction.c')
-rw-r--r--examples/web/physac/physics_friction.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/examples/web/physac/physics_friction.c b/examples/web/physac/physics_friction.c
index d015630..2b328a8 100644
--- a/examples/web/physac/physics_friction.c
+++ b/examples/web/physac/physics_friction.c
@@ -7,9 +7,9 @@
*
* Use the following line to compile:
*
-* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
+* gcc -o $(NAME_PART).exe $(FILE_NAME) -s $(RAYLIB_DIR)\raylib\raylib_icon -static -lraylib -lpthread
* -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm -std=c99 -Wl,--subsystem,windows -Wl,-allow-multiple-definition
-*
+*
* Copyright (c) 2017 Victor Fisac
*
********************************************************************************************/
@@ -26,15 +26,15 @@
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
-int screenWidth = 800;
-int screenHeight = 450;
+const int screenWidth = 800;
+const int screenHeight = 450;
// Physac logo drawing position
int logoX = 0;
int logoY = 15;
-PhysicsBody bodyA;
-PhysicsBody bodyB;
+PhysicsBody bodyA = { 0 };
+PhysicsBody bodyB = { 0 };
//----------------------------------------------------------------------------------
// Module Functions Declaration
@@ -42,9 +42,9 @@ PhysicsBody bodyB;
void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
-// Main Enry Point
+// Program Main Entry Point
//----------------------------------------------------------------------------------
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
@@ -60,7 +60,7 @@ int main()
// Create floor rectangle physics body
PhysicsBody ground = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, screenWidth, 100, 10);
ground->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
-
+
PhysicsBody wall = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight*0.8f }, 10, 80, 10);
wall->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
@@ -90,7 +90,7 @@ int main()
#else
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -99,7 +99,7 @@ int main()
#endif
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
ClosePhysics(); // Uninitialize physics
CloseWindow(); // Close window and OpenGL context
@@ -122,7 +122,7 @@ void UpdateDrawFrame(void)
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;