mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-23 07:39:18 -05:00
Cleanup warnings in examples (#5467)
This commit is contained in:
@ -46,12 +46,12 @@ int main(void)
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - ball physics");
|
||||
|
||||
Ball balls[MAX_BALLS] = {{
|
||||
.pos = { GetScreenWidth()/2, GetScreenHeight()/2 },
|
||||
.pos = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f },
|
||||
.vel = { 200, 200 },
|
||||
.ppos = { 0 },
|
||||
.radius = 40,
|
||||
.friction = 0.99,
|
||||
.elasticity = 0.9,
|
||||
.friction = 0.99f,
|
||||
.elasticity = 0.9f,
|
||||
.color = BLUE,
|
||||
.grabbed = false
|
||||
}};
|
||||
@ -110,11 +110,11 @@ int main(void)
|
||||
{
|
||||
balls[ballCount++] = (Ball){
|
||||
.pos = mousePos,
|
||||
.vel = { GetRandomValue(-300, 300), GetRandomValue(-300, 300) },
|
||||
.vel = { (float)GetRandomValue(-300, 300), (float)GetRandomValue(-300, 300) },
|
||||
.ppos = { 0 },
|
||||
.radius = 20 + GetRandomValue(0, 30),
|
||||
.friction = 0.99,
|
||||
.elasticity = 0.9,
|
||||
.radius = 20.0f + (float)GetRandomValue(0, 30),
|
||||
.friction = 0.99f,
|
||||
.elasticity = 0.9f,
|
||||
.color = { GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 },
|
||||
.grabbed = false
|
||||
};
|
||||
@ -126,7 +126,7 @@ int main(void)
|
||||
{
|
||||
for (int i = 0; i < ballCount; i++)
|
||||
{
|
||||
if (!balls[i].grabbed) balls[i].vel = (Vector2){ GetRandomValue(-2000, 2000), GetRandomValue(-2000, 2000) };
|
||||
if (!balls[i].grabbed) balls[i].vel = (Vector2){ (float)GetRandomValue(-2000, 2000), (float)GetRandomValue(-2000, 2000) };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,9 +50,9 @@ int main(void)
|
||||
int symmetry = 6;
|
||||
float angle = 360.0f/(float)symmetry;
|
||||
float thickness = 3.0f;
|
||||
Rectangle resetButtonRec = { screenWidth - 55, 5, 50, 25 };
|
||||
Rectangle backButtonRec = { screenWidth - 55, screenHeight - 30, 25, 25 };
|
||||
Rectangle nextButtonRec = { screenWidth - 30, screenHeight - 30, 25, 25 };
|
||||
Rectangle resetButtonRec = { screenWidth - 55.0f, 5.0f, 50, 25 };
|
||||
Rectangle backButtonRec = { screenWidth - 55.0f, screenHeight - 30.0f, 25, 25 };
|
||||
Rectangle nextButtonRec = { screenWidth - 30.0f, screenHeight - 30.0f, 25, 25 };
|
||||
Vector2 mousePos = { 0 };
|
||||
Vector2 prevMousePos = { 0 };
|
||||
Vector2 scaleVector = { 1.0f, -1.0f };
|
||||
|
||||
@ -185,12 +185,12 @@ static void BuildProductionStep(PenroseLSystem *ls)
|
||||
char *newProduction = (char *)RL_MALLOC(sizeof(char)*STR_MAX_SIZE);
|
||||
newProduction[0] = '\0';
|
||||
|
||||
int productionLength = strnlen(ls->production, STR_MAX_SIZE);
|
||||
int productionLength = (int)strnlen(ls->production, STR_MAX_SIZE);
|
||||
|
||||
for (int i = 0; i < productionLength; i++)
|
||||
{
|
||||
char step = ls->production[i];
|
||||
int remainingSpace = STR_MAX_SIZE - strnlen(newProduction, STR_MAX_SIZE) - 1;
|
||||
int remainingSpace = STR_MAX_SIZE - (int)strnlen(newProduction, STR_MAX_SIZE) - 1;
|
||||
switch (step)
|
||||
{
|
||||
case 'W': strncat(newProduction, ls->ruleW, remainingSpace); break;
|
||||
@ -201,7 +201,7 @@ static void BuildProductionStep(PenroseLSystem *ls)
|
||||
{
|
||||
if (step != 'F')
|
||||
{
|
||||
int t = strnlen(newProduction, STR_MAX_SIZE);
|
||||
int t = (int)strnlen(newProduction, STR_MAX_SIZE);
|
||||
newProduction[t] = step;
|
||||
newProduction[t + 1] = '\0';
|
||||
}
|
||||
@ -218,7 +218,7 @@ static void BuildProductionStep(PenroseLSystem *ls)
|
||||
// Draw penrose tile lines
|
||||
static void DrawPenroseLSystem(PenroseLSystem *ls)
|
||||
{
|
||||
Vector2 screenCenter = { GetScreenWidth()/2, GetScreenHeight()/2 };
|
||||
Vector2 screenCenter = { GetScreenWidth()/2.0f, GetScreenHeight()/2.0f };
|
||||
|
||||
TurtleState turtle = {
|
||||
.origin = { 0 },
|
||||
@ -245,7 +245,7 @@ static void DrawPenroseLSystem(PenroseLSystem *ls)
|
||||
Vector2 startPosScreen = { startPosWorld.x + screenCenter.x, startPosWorld.y + screenCenter.y };
|
||||
Vector2 endPosScreen = { turtle.origin.x + screenCenter.x, turtle.origin.y + screenCenter.y };
|
||||
|
||||
DrawLineEx(startPosScreen, endPosScreen, 2, Fade(BLACK, 0.2));
|
||||
DrawLineEx(startPosScreen, endPosScreen, 2, Fade(BLACK, 0.2f));
|
||||
}
|
||||
|
||||
repeats = 1;
|
||||
|
||||
Reference in New Issue
Block a user