Skip to content

Commit 6c51800

Browse files
authored
Fixes for 64 bit typecast warnings (#1733)
1 parent 8719858 commit 6c51800

18 files changed

Lines changed: 68 additions & 68 deletions

examples/core/core_window_letterbox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int main(void)
7070
Vector2 virtualMouse = { 0 };
7171
virtualMouse.x = (mouse.x - (GetScreenWidth() - (gameScreenWidth*scale))*0.5f)/scale;
7272
virtualMouse.y = (mouse.y - (GetScreenHeight() - (gameScreenHeight*scale))*0.5f)/scale;
73-
virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ gameScreenWidth, gameScreenHeight });
73+
virtualMouse = ClampValue(virtualMouse, (Vector2){ 0, 0 }, (Vector2){ (float)gameScreenWidth, (float)gameScreenHeight });
7474

7575
// Apply the same transformation as the virtual mouse to the real mouse (i.e. to work with raygui)
7676
//SetMouseOffset(-(GetScreenWidth() - (gameScreenWidth*scale))*0.5f, -(GetScreenHeight() - (gameScreenHeight*scale))*0.5f);

examples/physics/physics_shatter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int main(void)
3535
SetPhysicsGravity(0, 0);
3636

3737
// Create random polygon physics body to shatter
38-
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
38+
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
3939

4040
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
4141
//--------------------------------------------------------------------------------------
@@ -50,7 +50,7 @@ int main(void)
5050
{
5151
ResetPhysics();
5252

53-
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2, screenHeight/2 }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
53+
CreatePhysicsBodyPolygon((Vector2){ screenWidth/2.0f, screenHeight/2.0f }, GetRandomValue(80, 200), GetRandomValue(3, 8), 10);
5454
}
5555

5656
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) // Physics shatter input

examples/shaders/shaders_basic_lighting.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ int main(void)
146146

147147
// Draw the three models
148148
DrawModel(modelA, Vector3Zero(), 1.0f, WHITE);
149-
DrawModel(modelB, (Vector3){-1.6,0,0}, 1.0f, WHITE);
150-
DrawModel(modelC, (Vector3){ 1.6,0,0}, 1.0f, WHITE);
149+
DrawModel(modelB, (Vector3){-1.6f,0.0f,0.0f}, 1.0f, WHITE);
150+
DrawModel(modelC, (Vector3){ 1.6f,0.0f,0.0f}, 1.0f, WHITE);
151151

152152
// Draw markers to show where the lights are
153153
if (lights[0].enabled) { DrawSphereEx(lights[0].position, 0.2f, 8, 8, WHITE); }

examples/shaders/shaders_custom_uniform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ int main(void)
109109
BeginShaderMode(shader);
110110

111111
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
112-
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0, 0 }, WHITE);
112+
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0, 0 }, WHITE);
113113

114114
EndShaderMode();
115115

examples/shaders/shaders_eratosthenes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ int main(void)
7575

7676
BeginShaderMode(shader);
7777
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
78-
DrawTextureRec(target.texture, (Rectangle){ 0, 0, target.texture.width, -target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
78+
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
7979
EndShaderMode();
8080

8181
EndDrawing();

examples/shaders/shaders_fog.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,21 @@ int main(void)
102102

103103
if (IsKeyDown(KEY_UP))
104104
{
105-
fogDensity += 0.001;
106-
if (fogDensity > 1.0) fogDensity = 1.0;
105+
fogDensity += 0.001f;
106+
if (fogDensity > 1.0f) fogDensity = 1.0f;
107107
}
108108

109109
if (IsKeyDown(KEY_DOWN))
110110
{
111-
fogDensity -= 0.001;
112-
if (fogDensity < 0.0) fogDensity = 0.0;
111+
fogDensity -= 0.001f;
112+
if (fogDensity < 0.0f) fogDensity = 0.0f;
113113
}
114114

115115
SetShaderValue(shader, fogDensityLoc, &fogDensity, SHADER_UNIFORM_FLOAT);
116116

117117
// Rotate the torus
118-
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025));
119-
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012));
118+
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateX(-0.025f));
119+
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012f));
120120

121121
// Update the light shader with the camera view position
122122
SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], &camera.position.x, SHADER_UNIFORM_VEC3);
@@ -132,10 +132,10 @@ int main(void)
132132

133133
// Draw the three models
134134
DrawModel(modelA, Vector3Zero(), 1.0f, WHITE);
135-
DrawModel(modelB, (Vector3){ -2.6, 0, 0 }, 1.0f, WHITE);
136-
DrawModel(modelC, (Vector3){ 2.6, 0, 0 }, 1.0f, WHITE);
135+
DrawModel(modelB, (Vector3){ -2.6f, 0, 0 }, 1.0f, WHITE);
136+
DrawModel(modelC, (Vector3){ 2.6f, 0, 0 }, 1.0f, WHITE);
137137

138-
for (int i = -20; i < 20; i += 2) DrawModel(modelA,(Vector3){ i, 0, 2 }, 1.0f, WHITE);
138+
for (int i = -20; i < 20; i += 2) DrawModel(modelA,(Vector3){ (float)i, 0, 2 }, 1.0f, WHITE);
139139

140140
EndMode3D();
141141

examples/shaders/shaders_julia_set.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
// A few good julia sets
2828
const float pointsOfInterest[6][2] =
2929
{
30-
{ -0.348827, 0.607167 },
31-
{ -0.786268, 0.169728 },
32-
{ -0.8, 0.156 },
33-
{ 0.285, 0.0 },
34-
{ -0.835, -0.2321 },
35-
{ -0.70176, -0.3842 },
30+
{ -0.348827f, 0.607167f },
31+
{ -0.786268f, 0.169728f },
32+
{ -0.8f, 0.156f },
33+
{ 0.285f, 0.0f },
34+
{ -0.835f, -0.2321f },
35+
{ -0.70176f, -0.3842f },
3636
};
3737

3838
int main(void)

examples/shaders/shaders_spotlight.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,22 @@ int main(void)
116116
float sw = (float)GetScreenWidth();
117117
SetShaderValue(shdrSpot, wLoc, &sw, SHADER_UNIFORM_FLOAT);
118118

119-
// Randomise the locations and velocities of the spotlights
120-
// and initialise the shader locations
119+
// Randomize the locations and velocities of the spotlights
120+
// and initialize the shader locations
121121
for (int i = 0; i < MAX_SPOTS; i++)
122122
{
123-
spots[i].pos.x = GetRandomValue(64, screenWidth - 64);
124-
spots[i].pos.y = GetRandomValue(64, screenHeight - 64);
123+
spots[i].pos.x = GetRandomValue(64.0f, screenWidth - 64.0f);
124+
spots[i].pos.y = GetRandomValue(64.0f, screenHeight - 64.0f);
125125
spots[i].vel = (Vector2){ 0, 0 };
126126

127127
while ((fabs(spots[i].vel.x) + fabs(spots[i].vel.y)) < 2)
128128
{
129-
spots[i].vel.x = GetRandomValue(-40, 40)/10.0;
130-
spots[i].vel.y = GetRandomValue(-40, 40)/10.0;
129+
spots[i].vel.x = GetRandomValue(-400.f, 40.0f) / 10.0f;
130+
spots[i].vel.y = GetRandomValue(-400.f, 40.0f) / 10.0f;
131131
}
132132

133-
spots[i].inner = 28 * (i + 1);
134-
spots[i].radius = 48 * (i + 1);
133+
spots[i].inner = 28.0f * (i + 1);
134+
spots[i].radius = 48.0f * (i + 1);
135135

136136
SetShaderValue(shdrSpot, spots[i].posLoc, &spots[i].pos.x, SHADER_UNIFORM_VEC2);
137137
SetShaderValue(shdrSpot, spots[i].innerLoc, &spots[i].inner, SHADER_UNIFORM_FLOAT);
@@ -184,14 +184,14 @@ int main(void)
184184
for (int n = 0; n < MAX_STARS; n++)
185185
{
186186
// Single pixel is just too small these days!
187-
DrawRectangle(stars[n].pos.x, stars[n].pos.y, 2, 2, WHITE);
187+
DrawRectangle((int)stars[n].pos.x, (int)stars[n].pos.y, 2, 2, WHITE);
188188
}
189189

190190
for (int i = 0; i < 16; i++)
191191
{
192192
DrawTexture(texRay,
193-
(screenWidth/2.0) + cos((frameCounter + i*8)/51.45f)*(screenWidth/2.2) - 32,
194-
(screenHeight/2.0) + sin((frameCounter + i*8)/17.87f)*(screenHeight/4.2), WHITE);
193+
(screenWidth/2.0f) + cos((frameCounter + i*8)/51.45f)*(screenWidth/2.2f) - 32,
194+
(screenHeight/2.0f) + sin((frameCounter + i*8)/17.87f)*(screenHeight/4.2f), WHITE);
195195
}
196196

197197
// Draw spot lights

examples/shapes/shapes_basic_shapes.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ int main(void)
4545
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE); // NOTE: Uses QUADS internally, not lines
4646
DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
4747

48-
DrawTriangle((Vector2){screenWidth/4*3, 80},
49-
(Vector2){screenWidth/4*3 - 60, 150},
50-
(Vector2){screenWidth/4*3 + 60, 150}, VIOLET);
48+
DrawTriangle((Vector2){screenWidth/4.0f *3.0f, 80.0f},
49+
(Vector2){screenWidth/4.0f *3.0f - 60.0f, 150.0f},
50+
(Vector2){screenWidth/4.0f *3.0f + 60.0f, 150.0f}, VIOLET);
5151

5252
DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
5353

@@ -57,9 +57,9 @@ int main(void)
5757
// this way, all LINES are rendered in a single draw pass
5858
DrawLine(18, 42, screenWidth - 18, 42, BLACK);
5959
DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE);
60-
DrawTriangleLines((Vector2){screenWidth/4*3, 160},
61-
(Vector2){screenWidth/4*3 - 20, 230},
62-
(Vector2){screenWidth/4*3 + 20, 230}, DARKBLUE);
60+
DrawTriangleLines((Vector2){screenWidth/4.0f*3.0f, 160.0f},
61+
(Vector2){screenWidth/4.0f*3.0f - 20.0f, 230.0f},
62+
(Vector2){screenWidth/4.0f*3.0f + 20.0f, 230.0f}, DARKBLUE);
6363
EndDrawing();
6464
//----------------------------------------------------------------------------------
6565
}

examples/shapes/shapes_colors_palette.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ int main(void)
3737
// Fills colorsRecs data (for every rectangle)
3838
for (int i = 0; i < MAX_COLORS_COUNT; i++)
3939
{
40-
colorsRecs[i].x = 20 + 100*(i%7) + 10*(i%7);
41-
colorsRecs[i].y = 80 + 100*(i/7) + 10*(i/7);
42-
colorsRecs[i].width = 100;
43-
colorsRecs[i].height = 100;
40+
colorsRecs[i].x = 20.0f + 100.0f *(i%7) + 10.0f *(i%7);
41+
colorsRecs[i].y = 80.0f + 100.0f *(i/7) + 10.0f *(i/7);
42+
colorsRecs[i].width = 100.0f;
43+
colorsRecs[i].height = 100.0f;
4444
}
4545

4646
int colorState[MAX_COLORS_COUNT] = { 0 }; // Color state: 0-DEFAULT, 1-MOUSE_HOVER

0 commit comments

Comments
 (0)