|
|
@ -34,18 +34,18 @@ int main(void) |
|
|
|
InitPhysics(); |
|
|
|
|
|
|
|
// Create floor rectangle physics body |
|
|
|
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/i">2, screenHeight }, screenWidth, 100, 10); |
|
|
|
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/f">2.0f, (float)screenHeight }, (float)screenWidth, 100, 10); |
|
|
|
floor->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions) |
|
|
|
PhysicsBody wall = CreatePhysicsBodyRectangle((Vector2){ screenWidth/i">2, screenHeight*0.8f }, 10, 80, 10); |
|
|
|
PhysicsBody wall = CreatePhysicsBodyRectangle((Vector2){ screenWidth/f">2.0f, screenHeight*0.8f }, 10, 80, 10); |
|
|
|
wall->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions) |
|
|
|
|
|
|
|
// Create left ramp physics body |
|
|
|
PhysicsBody rectLeft = CreatePhysicsBodyRectangle((Vector2){ 25, screenHeight - 5 }, 250, 250, 10); |
|
|
|
PhysicsBody rectLeft = CreatePhysicsBodyRectangle((Vector2){ 25, p">(float)screenHeight - 5 }, 250, 250, 10); |
|
|
|
rectLeft->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions) |
|
|
|
SetPhysicsBodyRotation(rectLeft, 30*DEG2RAD); |
|
|
|
|
|
|
|
// Create right ramp physics body |
|
|
|
PhysicsBody rectRight = CreatePhysicsBodyRectangle((Vector2){ screenWidth - 25, screenHeight - 5 }, 250, 250, 10); |
|
|
|
PhysicsBody rectRight = CreatePhysicsBodyRectangle((Vector2){ p">(float)screenWidth - 25, (float)screenHeight - 5 }, 250, 250, 10); |
|
|
|
rectRight->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions) |
|
|
|
SetPhysicsBodyRotation(rectRight, 330*DEG2RAD); |
|
|
|
|
|
|
@ -55,7 +55,7 @@ int main(void) |
|
|
|
bodyA->dynamicFriction = 0.1f; |
|
|
|
SetPhysicsBodyRotation(bodyA, 30*DEG2RAD); |
|
|
|
|
|
|
|
PhysicsBody bodyB = CreatePhysicsBodyRectangle((Vector2){ screenWidth - 35, screenHeight*0.6f }, 40, 40, 10); |
|
|
|
PhysicsBody bodyB = CreatePhysicsBodyRectangle((Vector2){ p">(float)screenWidth - 35, (float)screenHeight*0.6f }, 40, 40, 10); |
|
|
|
bodyB->staticFriction = 1.0f; |
|
|
|
bodyB->dynamicFriction = 1.0f; |
|
|
|
SetPhysicsBodyRotation(bodyB, 330*DEG2RAD); |
|
|
@ -78,7 +78,7 @@ int main(void) |
|
|
|
bodyA->angularVelocity = 0; |
|
|
|
SetPhysicsBodyRotation(bodyA, 30*DEG2RAD); |
|
|
|
|
|
|
|
bodyB->position = (Vector2){ screenWidth - 35, screenHeight*0.6f }; |
|
|
|
bodyB->position = (Vector2){ p">(float)screenWidth - 35, screenHeight * 0.6f }; |
|
|
|
bodyB->velocity = (Vector2){ 0, 0 }; |
|
|
|
bodyB->angularVelocity = 0; |
|
|
|
SetPhysicsBodyRotation(bodyB, 330*DEG2RAD); |
|
|
@ -118,9 +118,9 @@ int main(void) |
|
|
|
|
|
|
|
DrawRectangle(0, screenHeight - 49, screenWidth, 49, BLACK); |
|
|
|
|
|
|
|
DrawText("Friction amount", (screenWidth - MeasureText("Friction amount", 30))/i">2, 75, 30, WHITE); |
|
|
|
DrawText("0.1", bodyA->position.x - MeasureText("0.1", 20)/2, bodyA->position.y - 7, 20, WHITE); |
|
|
|
DrawText("1", bodyB->position.x - MeasureText("1", 20)/2, bodyB->position.y - 7, 20, WHITE); |
|
|
|
DrawText("Friction amount", (screenWidth - MeasureText("Friction amount", 30))/f">2.0f, 75, 30, WHITE); |
|
|
|
DrawText("0.1", p">(int)bodyA->position.x - MeasureText("0.1", 20)/2, (int)bodyA->position.y - 7, 20, WHITE); |
|
|
|
DrawText("1", p">(int)bodyB->position.x - MeasureText("1", 20)/2, (int)bodyB->position.y - 7, 20, WHITE); |
|
|
|
|
|
|
|
DrawText("Press 'R' to reset example", 10, 10, 10, WHITE); |
|
|
|
|
|
|
|