Fix VC warnings for examples (#2085)
This commit is contained in:
parent
086f76ba7a
commit
daeccd03ac
21 changed files with 104 additions and 104 deletions
|
@ -34,11 +34,11 @@ int main(void)
|
|||
InitPhysics();
|
||||
|
||||
// Create floor rectangle physics body
|
||||
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
|
||||
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2.0f, (float)screenHeight }, 500, 100, 10);
|
||||
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);
|
||||
PhysicsBody circle = CreatePhysicsBodyCircle((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, 45, 10);
|
||||
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
|
||||
|
@ -55,16 +55,16 @@ int main(void)
|
|||
{
|
||||
ResetPhysics();
|
||||
|
||||
floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, 500, 100, 10);
|
||||
floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2.0f, (float)screenHeight }, 500, 100, 10);
|
||||
floor->enabled = false;
|
||||
|
||||
circle = CreatePhysicsBodyCircle((Vector2){ screenWidth/2, screenHeight/2 }, 45, 10);
|
||||
circle = CreatePhysicsBodyCircle((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, 45, 10);
|
||||
circle->enabled = false;
|
||||
}
|
||||
|
||||
// Physics body creation inputs
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) CreatePhysicsBodyPolygon(GetMousePosition(), GetRandomValue(20, 80), GetRandomValue(3, 8), 10);
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) CreatePhysicsBodyCircle(GetMousePosition(), GetRandomValue(10, 45), 10);
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) CreatePhysicsBodyPolygon(GetMousePosition(), (float)GetRandomValue(20, 80), GetRandomValue(3, 8), 10);
|
||||
else if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT)) CreatePhysicsBodyCircle(GetMousePosition(), (float)GetRandomValue(10, 45), 10);
|
||||
|
||||
// Destroy falling physics bodies
|
||||
int bodiesCount = GetPhysicsBodiesCount();
|
||||
|
|
|
@ -34,18 +34,18 @@ int main(void)
|
|||
InitPhysics();
|
||||
|
||||
// Create floor rectangle physics body
|
||||
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, screenWidth, 100, 10);
|
||||
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/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/2, screenHeight*0.8f }, 10, 80, 10);
|
||||
PhysicsBody wall = CreatePhysicsBodyRectangle((Vector2){ screenWidth/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, (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){ (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){ (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){ (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))/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))/2.0f, 75, 30, WHITE);
|
||||
DrawText("0.1", (int)bodyA->position.x - MeasureText("0.1", 20)/2, (int)bodyA->position.y - 7, 20, WHITE);
|
||||
DrawText("1", (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);
|
||||
|
||||
|
|
|
@ -36,11 +36,11 @@ int main(void)
|
|||
InitPhysics();
|
||||
|
||||
// Create floor and walls rectangle physics body
|
||||
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, screenWidth, 100, 10);
|
||||
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2.0f, (float)screenHeight }, (float)screenWidth, 100, 10);
|
||||
PhysicsBody platformLeft = CreatePhysicsBodyRectangle((Vector2){ screenWidth*0.25f, screenHeight*0.6f }, screenWidth*0.25f, 10, 10);
|
||||
PhysicsBody platformRight = CreatePhysicsBodyRectangle((Vector2){ screenWidth*0.75f, screenHeight*0.6f }, screenWidth*0.25f, 10, 10);
|
||||
PhysicsBody wallLeft = CreatePhysicsBodyRectangle((Vector2){ -5, screenHeight/2 }, 10, screenHeight, 10);
|
||||
PhysicsBody wallRight = CreatePhysicsBodyRectangle((Vector2){ screenWidth + 5, screenHeight/2 }, 10, screenHeight, 10);
|
||||
PhysicsBody wallLeft = CreatePhysicsBodyRectangle((Vector2){ -5, screenHeight/2.0f }, 10, (float)screenHeight, 10);
|
||||
PhysicsBody wallRight = CreatePhysicsBodyRectangle((Vector2){ (float)screenWidth + 5, screenHeight/2.0f }, 10, (float)screenHeight, 10);
|
||||
|
||||
// Disable dynamics to floor and walls physics bodies
|
||||
floor->enabled = false;
|
||||
|
@ -50,7 +50,7 @@ int main(void)
|
|||
wallRight->enabled = false;
|
||||
|
||||
// Create movement physics body
|
||||
PhysicsBody body = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight/2 }, 50, 50, 1);
|
||||
PhysicsBody body = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, 50, 50, 1);
|
||||
body->freezeOrient = true; // Constrain body rotation to avoid little collision torque amounts
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
|
@ -66,7 +66,7 @@ int main(void)
|
|||
if (IsKeyPressed(KEY_R)) // Reset physics input
|
||||
{
|
||||
// Reset movement physics body position, velocity and rotation
|
||||
body->position = (Vector2){ screenWidth/2, screenHeight/2 };
|
||||
body->position = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
|
||||
body->velocity = (Vector2){ 0, 0 };
|
||||
SetPhysicsBodyRotation(body, 0);
|
||||
}
|
||||
|
|
|
@ -34,16 +34,16 @@ int main(void)
|
|||
InitPhysics();
|
||||
|
||||
// Create floor rectangle physics body
|
||||
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2, screenHeight }, screenWidth, 100, 10);
|
||||
PhysicsBody floor = CreatePhysicsBodyRectangle((Vector2){ screenWidth/2.0f, (float)screenHeight }, (float)screenWidth, 100, 10);
|
||||
floor->enabled = false; // Disable body state to convert it to static (no dynamics, but collisions)
|
||||
floor->restitution = 1;
|
||||
|
||||
// Create circles physics body
|
||||
PhysicsBody circleA = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.25f, screenHeight/2 }, 30, 10);
|
||||
PhysicsBody circleA = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.25f, screenHeight/2.0f }, 30, 10);
|
||||
circleA->restitution = 0;
|
||||
PhysicsBody circleB = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.5f, screenHeight/2 }, 30, 10);
|
||||
PhysicsBody circleB = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.5f, screenHeight/2.0f }, 30, 10);
|
||||
circleB->restitution = 0.5f;
|
||||
PhysicsBody circleC = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.75f, screenHeight/2 }, 30, 10);
|
||||
PhysicsBody circleC = CreatePhysicsBodyCircle((Vector2){ screenWidth*0.75f, screenHeight/2.0f }, 30, 10);
|
||||
circleC->restitution = 1;
|
||||
|
||||
// Restitution demo needs a very tiny physics time step for a proper simulation
|
||||
|
@ -62,11 +62,11 @@ int main(void)
|
|||
if (IsKeyPressed(KEY_R)) // Reset physics input
|
||||
{
|
||||
// Reset circles physics bodies position and velocity
|
||||
circleA->position = (Vector2){ screenWidth*0.25f, screenHeight/2 };
|
||||
circleA->position = (Vector2){ screenWidth*0.25f, screenHeight/2.0f };
|
||||
circleA->velocity = (Vector2){ 0, 0 };
|
||||
circleB->position = (Vector2){ screenWidth*0.5f, screenHeight/2 };
|
||||
circleB->position = (Vector2){ screenWidth*0.5f, screenHeight/2.0f };
|
||||
circleB->velocity = (Vector2){ 0, 0 };
|
||||
circleC->position = (Vector2){ screenWidth*0.75f, screenHeight/2 };
|
||||
circleC->position = (Vector2){ screenWidth*0.75f, screenHeight/2.0f };
|
||||
circleC->velocity = (Vector2){ 0, 0 };
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -100,9 +100,9 @@ int main(void)
|
|||
}
|
||||
|
||||
DrawText("Restitution amount", (screenWidth - MeasureText("Restitution amount", 30))/2, 75, 30, WHITE);
|
||||
DrawText("0", circleA->position.x - MeasureText("0", 20)/2, circleA->position.y - 7, 20, WHITE);
|
||||
DrawText("0.5", circleB->position.x - MeasureText("0.5", 20)/2, circleB->position.y - 7, 20, WHITE);
|
||||
DrawText("1", circleC->position.x - MeasureText("1", 20)/2, circleC->position.y - 7, 20, WHITE);
|
||||
DrawText("0", (int)circleA->position.x - MeasureText("0", 20)/2, circleA->position.y - 7, 20, WHITE);
|
||||
DrawText("0.5", (int)circleB->position.x - MeasureText("0.5", 20)/2, circleB->position.y - 7, 20, WHITE);
|
||||
DrawText("1", (int)circleC->position.x - MeasureText("1", 20)/2, circleC->position.y - 7, 20, WHITE);
|
||||
|
||||
DrawText("Press 'R' to reset example", 10, 10, 10, WHITE);
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ int main(void)
|
|||
SetPhysicsGravity(0, 0);
|
||||
|
||||
// Create random polygon physics body to shatter
|
||||
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
|
||||
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, (float)GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -50,7 +50,7 @@ int main(void)
|
|||
{
|
||||
ResetPhysics();
|
||||
|
||||
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
|
||||
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, (float)GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
|
||||
}
|
||||
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) // Physics shatter input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue