[examples] Fix examples to work in MSVC (#5267)

* Fix warnings in many examples
Add examples to MSVC solution correctly

* fix CI error

---------

Co-authored-by: Ray <raysan5@gmail.com>
This commit is contained in:
Jeffery Myers
2025-10-15 10:02:52 -07:00
committed by GitHub
parent e3a562ab57
commit 7191749d66
34 changed files with 1550 additions and 405 deletions

View File

@@ -252,7 +252,11 @@ int main()
// Draw spheres to show the lights positions
for (int i = 0; i < MAX_LIGHTS; i++)
{
Color lightColor = (Color){ lights[i].color[0]*255, lights[i].color[1]*255, lights[i].color[2]*255, lights[i].color[3]*255 };
Color lightColor = (Color){
(unsigned char)(lights[i].color[0]*255),
(unsigned char)(lights[i].color[1] * 255),
(unsigned char)(lights[i].color[2] * 255),
(unsigned char)(lights[i].color[3] * 255) };
if (lights[i].enabled) DrawSphereEx(lights[i].position, 0.2f, 8, 8, lightColor);
else DrawSphereWires(lights[i].position, 0.2f, 8, 8, ColorAlpha(lightColor, 0.3f));

View File

@@ -102,7 +102,7 @@ int main(void)
BeginBlendMode(BLEND_ADDITIVE);
DrawTexturePro(
light,
(Rectangle){ 0, 0, light.width, light.height },
(Rectangle){ 0, 0, (float)light.width, (float)light.height },
(Rectangle){ 0, 0, 20, 20 },
(Vector2){ 10.0, 10.0 },
0.0,
@@ -110,7 +110,7 @@ int main(void)
);
DrawTexturePro(
light,
(Rectangle){ 0, 0, light.width, light.height },
(Rectangle){ 0, 0, (float)light.width, (float)light.height },
(Rectangle){ 8, 4, 20, 20 },
(Vector2){ 10.0, 10.0 },
0.0,
@@ -118,7 +118,7 @@ int main(void)
);
DrawTexturePro(
light,
(Rectangle){ 0, 0, light.width, light.height },
(Rectangle){ 0, 0, (float)light.width, (float)light.height },
(Rectangle){ 8, 8, 10, 10 },
(Vector2){ 5.0, 5.0 },
0.0,
@@ -152,7 +152,7 @@ int main(void)
DrawTexturePro(
lightmap.texture,
(Rectangle){ 0, 0, -MAP_SIZE, -MAP_SIZE },
(Rectangle){ GetRenderWidth() - MAP_SIZE*8 - 10, 10, MAP_SIZE*8, MAP_SIZE*8 },
(Rectangle){ (float)GetRenderWidth() - MAP_SIZE*8 - 10, 10, (float)MAP_SIZE*8, (float)MAP_SIZE*8 },
(Vector2){ 0.0, 0.0 },
0.0,
WHITE);

View File

@@ -113,7 +113,7 @@ int main(void)
if (IsKeyPressed(KEY_N)) useNormalMap = !useNormalMap;
// Spin plane model at a constant rate
plane.transform = MatrixRotateY(GetTime()*0.5f);
plane.transform = MatrixRotateY((float)GetTime()*0.5f);
// Update shader values
float lightPos[3] = {lightPosition.x, lightPosition.y, lightPosition.z};