diff options
| author | Jeffery Myers <[email protected]> | 2024-06-24 08:47:32 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-06-24 17:47:32 +0200 |
| commit | e96bab7ce63568d86fae4fd664fa06625f76f1ee (patch) | |
| tree | d1fa5e419ac6846e64101afb39667ab10942c4bf /examples | |
| parent | 4311db5ba5eb23c8f1d71268010afb135f3e1e25 (diff) | |
| download | raylib-e96bab7ce63568d86fae4fd664fa06625f76f1ee.tar.gz raylib-e96bab7ce63568d86fae4fd664fa06625f76f1ee.zip | |
[Build] Fix warnings when building in VS 2022 (#4095)
* Update raylib_api.* by CI
* Fix warnings when building examples in MSVC 2022
* fix auto-format that sneaked in there.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/audio/audio_mixed_processor.c | 2 | ||||
| -rw-r--r-- | examples/core/core_2d_camera_platformer.c | 4 | ||||
| -rw-r--r-- | examples/core/core_input_mouse_wheel.c | 2 | ||||
| -rw-r--r-- | examples/core/core_random_sequence.c | 16 | ||||
| -rw-r--r-- | examples/core/core_smooth_pixelperfect.c | 8 | ||||
| -rw-r--r-- | examples/core/core_storage_values.c | 2 | ||||
| -rw-r--r-- | examples/models/models_draw_cube_texture.c | 2 | ||||
| -rw-r--r-- | examples/shaders/shaders_deferred_render.c | 6 | ||||
| -rw-r--r-- | examples/shapes/shapes_lines_bezier.c | 4 | ||||
| -rw-r--r-- | examples/shapes/shapes_splines_drawing.c | 2 |
10 files changed, 24 insertions, 24 deletions
diff --git a/examples/audio/audio_mixed_processor.c b/examples/audio/audio_mixed_processor.c index 3a008f3e..fd970dd1 100644 --- a/examples/audio/audio_mixed_processor.c +++ b/examples/audio/audio_mixed_processor.c @@ -97,7 +97,7 @@ int main(void) DrawRectangle(199, 199, 402, 34, LIGHTGRAY); for (int i = 0; i < 400; i++) { - DrawLine(201 + i, 232 - averageVolume[i] * 32, 201 + i, 232, MAROON); + DrawLine(201 + i, 232 - (int)averageVolume[i] * 32, 201 + i, 232, MAROON); } DrawRectangleLines(199, 199, 402, 34, GRAY); diff --git a/examples/core/core_2d_camera_platformer.c b/examples/core/core_2d_camera_platformer.c index 75fd6cf6..3743de80 100644 --- a/examples/core/core_2d_camera_platformer.c +++ b/examples/core/core_2d_camera_platformer.c @@ -133,10 +133,10 @@ int main(void) for (int i = 0; i < envItemsLength; i++) DrawRectangleRec(envItems[i].rect, envItems[i].color); - Rectangle playerRect = { player.position.x - 20, player.position.y - 40, 40, 40 }; + Rectangle playerRect = { player.position.x - 20, player.position.y - 40, 40.0f, 40.0f }; DrawRectangleRec(playerRect, RED); - DrawCircle(player.position.x, player.position.y, 5, GOLD); + DrawCircleV(player.position, 5.0f, GOLD); EndMode2D(); diff --git a/examples/core/core_input_mouse_wheel.c b/examples/core/core_input_mouse_wheel.c index 54f33545..d261e934 100644 --- a/examples/core/core_input_mouse_wheel.c +++ b/examples/core/core_input_mouse_wheel.c @@ -36,7 +36,7 @@ int main(void) { // Update //---------------------------------------------------------------------------------- - boxPositionY -= (GetMouseWheelMove()*scrollSpeed); + boxPositionY -= (int)(GetMouseWheelMove()*scrollSpeed); //---------------------------------------------------------------------------------- // Draw diff --git a/examples/core/core_random_sequence.c b/examples/core/core_random_sequence.c index c946b64d..2f7c3be9 100644 --- a/examples/core/core_random_sequence.c +++ b/examples/core/core_random_sequence.c @@ -41,7 +41,7 @@ int main(void) { int rectCount = 20; float rectSize = (float)screenWidth/rectCount; - ColorRect* rectangles = GenerateRandomColorRectSequence(rectCount, rectSize, screenWidth, 0.75f * screenHeight); + ColorRect* rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight); SetTargetFPS(60); //-------------------------------------------------------------------------------------- @@ -62,7 +62,7 @@ int main(void) { rectCount++; rectSize = (float)screenWidth/rectCount; free(rectangles); - rectangles = GenerateRandomColorRectSequence(rectCount, rectSize, screenWidth, 0.75f * screenHeight); + rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight); } if(IsKeyPressed(KEY_DOWN)) @@ -71,7 +71,7 @@ int main(void) { rectCount--; rectSize = (float)screenWidth/rectCount; free(rectangles); - rectangles = GenerateRandomColorRectSequence(rectCount, rectSize, screenWidth, 0.75f * screenHeight); + rectangles = GenerateRandomColorRectSequence((float)rectCount, rectSize, (float)screenWidth, 0.75f * screenHeight); } } @@ -121,17 +121,17 @@ static Color GenerateRandomColor() } static ColorRect* GenerateRandomColorRectSequence(float rectCount, float rectWidth, float screenWidth, float screenHeight){ - int *seq = LoadRandomSequence(rectCount, 0, rectCount-1); - ColorRect* rectangles = (ColorRect *)malloc(rectCount*sizeof(ColorRect)); + int *seq = LoadRandomSequence((unsigned int)rectCount, 0, (unsigned int)rectCount-1); + ColorRect* rectangles = (ColorRect *)malloc((int)rectCount*sizeof(ColorRect)); float rectSeqWidth = rectCount * rectWidth; - int startX = (screenWidth - rectSeqWidth) * 0.5f; + float startX = (screenWidth - rectSeqWidth) * 0.5f; for(int x=0;x<rectCount;x++){ - int rectHeight = Remap(seq[x], 0, rectCount-1, 0, screenHeight); + int rectHeight = (int)Remap((float)seq[x], 0, rectCount-1, 0, screenHeight); rectangles[x].c = GenerateRandomColor(); rectangles[x].r = CLITERAL(Rectangle){ - startX + x * rectWidth, screenHeight - rectHeight, rectWidth, rectHeight + startX + x * rectWidth, screenHeight - rectHeight, rectWidth, (float)rectHeight }; } UnloadRandomSequence(seq); diff --git a/examples/core/core_smooth_pixelperfect.c b/examples/core/core_smooth_pixelperfect.c index 99180598..d7655765 100644 --- a/examples/core/core_smooth_pixelperfect.c +++ b/examples/core/core_smooth_pixelperfect.c @@ -69,18 +69,18 @@ int main(void) rotation += 60.0f*GetFrameTime(); // Rotate the rectangles, 60 degrees per second // Make the camera move to demonstrate the effect - cameraX = (sinf(GetTime())*50.0f) - 10.0f; - cameraY = cosf(GetTime())*30.0f; + cameraX = (sinf((float)GetTime())*50.0f) - 10.0f; + cameraY = cosf((float)GetTime())*30.0f; // Set the camera's target to the values computed above screenSpaceCamera.target = (Vector2){ cameraX, cameraY }; // Round worldSpace coordinates, keep decimals into screenSpace coordinates - worldSpaceCamera.target.x = (int)screenSpaceCamera.target.x; + worldSpaceCamera.target.x = truncf(screenSpaceCamera.target.x); screenSpaceCamera.target.x -= worldSpaceCamera.target.x; screenSpaceCamera.target.x *= virtualRatio; - worldSpaceCamera.target.y = (int)screenSpaceCamera.target.y; + worldSpaceCamera.target.y = truncf(screenSpaceCamera.target.y); screenSpaceCamera.target.y -= worldSpaceCamera.target.y; screenSpaceCamera.target.y *= virtualRatio; //---------------------------------------------------------------------------------- diff --git a/examples/core/core_storage_values.c b/examples/core/core_storage_values.c index 39edcb5e..70386da6 100644 --- a/examples/core/core_storage_values.c +++ b/examples/core/core_storage_values.c @@ -177,7 +177,7 @@ int LoadStorageValue(unsigned int position) if (fileData != NULL) { - if (dataSize < (position*4)) TraceLog(LOG_WARNING, "FILEIO: [%s] Failed to find storage position: %i", STORAGE_DATA_FILE, position); + if (dataSize < ((int)(position*4))) TraceLog(LOG_WARNING, "FILEIO: [%s] Failed to find storage position: %i", STORAGE_DATA_FILE, position); else { int *dataPtr = (int *)fileData; diff --git a/examples/models/models_draw_cube_texture.c b/examples/models/models_draw_cube_texture.c index edcd4b7f..87d83c8f 100644 --- a/examples/models/models_draw_cube_texture.c +++ b/examples/models/models_draw_cube_texture.c @@ -67,7 +67,7 @@ int main(void) DrawCubeTexture(texture, (Vector3){ -2.0f, 2.0f, 0.0f }, 2.0f, 4.0f, 2.0f, WHITE); // Draw cube with an applied texture, but only a defined rectangle piece of the texture - DrawCubeTextureRec(texture, (Rectangle){ 0, texture.height/2, texture.width/2, texture.height/2 }, + DrawCubeTextureRec(texture, (Rectangle){ 0.0f, texture.height/2.0f, texture.width/2.0f, texture.height/2.0f }, (Vector3){ 2.0f, 1.0f, 0.0f }, 2.0f, 2.0f, 2.0f, WHITE); DrawGrid(10, 1.0f); // Draw a grid diff --git a/examples/shaders/shaders_deferred_render.c b/examples/shaders/shaders_deferred_render.c index 1c2db7b5..4f652fe3 100644 --- a/examples/shaders/shaders_deferred_render.c +++ b/examples/shaders/shaders_deferred_render.c @@ -281,7 +281,7 @@ int main(void) .id = gBuffer.positionTexture, .width = screenWidth, .height = screenHeight, - }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); + }, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, Vector2Zero(), RAYWHITE); DrawText("POSITION TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); } break; @@ -291,7 +291,7 @@ int main(void) .id = gBuffer.normalTexture, .width = screenWidth, .height = screenHeight, - }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); + }, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, Vector2Zero(), RAYWHITE); DrawText("NORMAL TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); } break; @@ -301,7 +301,7 @@ int main(void) .id = gBuffer.albedoSpecTexture, .width = screenWidth, .height = screenHeight, - }, (Rectangle) { 0, 0, screenWidth, -screenHeight }, Vector2Zero(), RAYWHITE); + }, (Rectangle) { 0, 0, (float)screenWidth, (float)-screenHeight }, Vector2Zero(), RAYWHITE); DrawText("ALBEDO TEXTURE", 10, screenHeight - 30, 20, DARKGREEN); } break; diff --git a/examples/shapes/shapes_lines_bezier.c b/examples/shapes/shapes_lines_bezier.c index eeb7aeed..1293e16e 100644 --- a/examples/shapes/shapes_lines_bezier.c +++ b/examples/shapes/shapes_lines_bezier.c @@ -69,8 +69,8 @@ int main(void) DrawLineBezier(startPoint, endPoint, 4.0f, BLUE); // Draw start-end spline circles with some details - DrawCircleV(startPoint, CheckCollisionPointCircle(mouse, startPoint, 10.0f)? 14 : 8, moveStartPoint? RED : BLUE); - DrawCircleV(endPoint, CheckCollisionPointCircle(mouse, endPoint, 10.0f)? 14 : 8, moveEndPoint? RED : BLUE); + DrawCircleV(startPoint, CheckCollisionPointCircle(mouse, startPoint, 10.0f)? 14.0f : 8.0f, moveStartPoint? RED : BLUE); + DrawCircleV(endPoint, CheckCollisionPointCircle(mouse, endPoint, 10.0f)? 14.0f : 8.0f, moveEndPoint? RED : BLUE); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/examples/shapes/shapes_splines_drawing.c b/examples/shapes/shapes_splines_drawing.c index 7c099e7e..536b558e 100644 --- a/examples/shapes/shapes_splines_drawing.c +++ b/examples/shapes/shapes_splines_drawing.c @@ -242,7 +242,7 @@ int main(void) (splineTypeActive != SPLINE_BEZIER) && (i < pointCount - 1)) DrawLineV(points[i], points[i + 1], GRAY); - DrawText(TextFormat("[%.0f, %.0f]", points[i].x, points[i].y), points[i].x, points[i].y + 10, 10, BLACK); + DrawText(TextFormat("[%.0f, %.0f]", points[i].x, points[i].y), (int)points[i].x, (int)points[i].y + 10, 10, BLACK); } } |
