[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>
This commit is contained in:
Jeffery Myers
2024-06-24 08:47:32 -07:00
committed by GitHub
parent 4311db5ba5
commit e96bab7ce6
15 changed files with 60 additions and 58 deletions

View File

@@ -856,7 +856,7 @@ void EndDrawing(void)
#ifndef GIF_RECORD_FRAMERATE
#define GIF_RECORD_FRAMERATE 10
#endif
gifFrameCounter += GetFrameTime()*1000;
gifFrameCounter += (unsigned int)(GetFrameTime()*1000);
// NOTE: We record one gif frame depending on the desired gif framerate
if (gifFrameCounter > 1000/GIF_RECORD_FRAMERATE)

View File

@@ -3945,7 +3945,9 @@ void rlSetVertexAttribute(unsigned int index, int compSize, int type, bool norma
// Additional types (depends on OpenGL version or extensions):
// - GL_HALF_FLOAT, GL_FLOAT, GL_DOUBLE, GL_FIXED,
// - GL_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_10F_11F_11F_REV
glVertexAttribPointer(index, compSize, type, normalized, stride, (void *)offset);
size_t offsetNative = offset;
glVertexAttribPointer(index, compSize, type, normalized, stride, (void *)offsetNative);
#endif
}

View File

@@ -2297,7 +2297,7 @@ static Font LoadBMFont(const char *fileName)
}
else
{
font.glyphs[i].image = GenImageColor(font.recs[i].width, font.recs[i].height, BLACK);
font.glyphs[i].image = GenImageColor((int)font.recs[i].width, (int)font.recs[i].height, BLACK);
TRACELOG(LOG_WARNING, "FONT: [%s] Some characters data not correctly provided", fileName);
}
}

View File

@@ -3646,10 +3646,10 @@ void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color col
{
// Calculate the 2D bounding box of the triangle
// Determine the minimum and maximum x and y coordinates of the triangle vertices
int xMin = (v1.x < v2.x)? ((v1.x < v3.x)? v1.x : v3.x) : ((v2.x < v3.x)? v2.x : v3.x);
int yMin = (v1.y < v2.y)? ((v1.y < v3.y)? v1.y : v3.y) : ((v2.y < v3.y)? v2.y : v3.y);
int xMax = (v1.x > v2.x)? ((v1.x > v3.x)? v1.x : v3.x) : ((v2.x > v3.x)? v2.x : v3.x);
int yMax = (v1.y > v2.y)? ((v1.y > v3.y)? v1.y : v3.y) : ((v2.y > v3.y)? v2.y : v3.y);
int xMin = (int)((v1.x < v2.x)? ((v1.x < v3.x) ? v1.x : v3.x) : ((v2.x < v3.x) ? v2.x : v3.x));
int yMin = (int)((v1.y < v2.y)? ((v1.y < v3.y) ? v1.y : v3.y) : ((v2.y < v3.y) ? v2.y : v3.y));
int xMax = (int)((v1.x > v2.x)? ((v1.x > v3.x) ? v1.x : v3.x) : ((v2.x > v3.x) ? v2.x : v3.x));
int yMax = (int)((v1.y > v2.y)? ((v1.y > v3.y) ? v1.y : v3.y) : ((v2.y > v3.y) ? v2.y : v3.y));
// Clamp the bounding box to the image dimensions
if (xMin < 0) xMin = 0;
@@ -3664,9 +3664,9 @@ void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color col
// Barycentric interpolation setup
// Calculate the step increments for the barycentric coordinates
int w1XStep = v3.y - v2.y, w1YStep = v2.x - v3.x;
int w2XStep = v1.y - v3.y, w2YStep = v3.x - v1.x;
int w3XStep = v2.y - v1.y, w3YStep = v1.x - v2.x;
int w1XStep = (int)(v3.y - v2.y), w1YStep = (int)(v2.x - v3.x);
int w2XStep = (int)(v1.y - v3.y), w2YStep = (int)(v3.x - v1.x);
int w3XStep = (int)(v2.y - v1.y), w3YStep = (int)(v1.x - v2.x);
// If the triangle is a back face, invert the steps
if (isBackFace)
@@ -3677,9 +3677,9 @@ void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color col
}
// Calculate the initial barycentric coordinates for the top-left point of the bounding box
int w1Row = (xMin - v2.x)*w1XStep + w1YStep*(yMin - v2.y);
int w2Row = (xMin - v3.x)*w2XStep + w2YStep*(yMin - v3.y);
int w3Row = (xMin - v1.x)*w3XStep + w3YStep*(yMin - v1.y);
int w1Row = (int)((xMin - v2.x)*w1XStep + w1YStep*(yMin - v2.y));
int w2Row = (int)((xMin - v3.x)*w2XStep + w2YStep*(yMin - v3.y));
int w3Row = (int)((xMin - v1.x)*w3XStep + w3YStep*(yMin - v1.y));
// Rasterization loop
// Iterate through each pixel in the bounding box
@@ -3713,10 +3713,10 @@ void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c
{
// Calculate the 2D bounding box of the triangle
// Determine the minimum and maximum x and y coordinates of the triangle vertices
int xMin = (v1.x < v2.x)? ((v1.x < v3.x)? v1.x : v3.x) : ((v2.x < v3.x)? v2.x : v3.x);
int yMin = (v1.y < v2.y)? ((v1.y < v3.y)? v1.y : v3.y) : ((v2.y < v3.y)? v2.y : v3.y);
int xMax = (v1.x > v2.x)? ((v1.x > v3.x)? v1.x : v3.x) : ((v2.x > v3.x)? v2.x : v3.x);
int yMax = (v1.y > v2.y)? ((v1.y > v3.y)? v1.y : v3.y) : ((v2.y > v3.y)? v2.y : v3.y);
int xMin = (int)((v1.x < v2.x)? ((v1.x < v3.x)? v1.x : v3.x) : ((v2.x < v3.x)? v2.x : v3.x));
int yMin = (int)((v1.y < v2.y)? ((v1.y < v3.y)? v1.y : v3.y) : ((v2.y < v3.y)? v2.y : v3.y));
int xMax = (int)((v1.x > v2.x)? ((v1.x > v3.x)? v1.x : v3.x) : ((v2.x > v3.x)? v2.x : v3.x));
int yMax = (int)((v1.y > v2.y)? ((v1.y > v3.y)? v1.y : v3.y) : ((v2.y > v3.y)? v2.y : v3.y));
// Clamp the bounding box to the image dimensions
if (xMin < 0) xMin = 0;
@@ -3731,9 +3731,9 @@ void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c
// Barycentric interpolation setup
// Calculate the step increments for the barycentric coordinates
int w1XStep = v3.y - v2.y, w1YStep = v2.x - v3.x;
int w2XStep = v1.y - v3.y, w2YStep = v3.x - v1.x;
int w3XStep = v2.y - v1.y, w3YStep = v1.x - v2.x;
int w1XStep = (int)(v3.y - v2.y), w1YStep = (int)(v2.x - v3.x);
int w2XStep = (int)(v1.y - v3.y), w2YStep = (int)(v3.x - v1.x);
int w3XStep = (int)(v2.y - v1.y), w3YStep = (int)(v1.x - v2.x);
// If the triangle is a back face, invert the steps
if (isBackFace)
@@ -3744,9 +3744,9 @@ void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c
}
// Calculate the initial barycentric coordinates for the top-left point of the bounding box
int w1Row = (xMin - v2.x)*w1XStep + w1YStep*(yMin - v2.y);
int w2Row = (xMin - v3.x)*w2XStep + w2YStep*(yMin - v3.y);
int w3Row = (xMin - v1.x)*w3XStep + w3YStep*(yMin - v1.y);
int w1Row = (int)((xMin - v2.x)*w1XStep + w1YStep*(yMin - v2.y));
int w2Row = (int)((xMin - v3.x)*w2XStep + w2YStep*(yMin - v3.y));
int w3Row = (int)((xMin - v1.x)*w3XStep + w3YStep*(yMin - v1.y));
// Calculate the inverse of the sum of the barycentric coordinates for normalization
// NOTE 1: Here, we act as if we multiply by 255 the reciprocal, which avoids additional
@@ -3799,9 +3799,9 @@ void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c
// Draw triangle outline within an image
void ImageDrawTriangleLines(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color color)
{
ImageDrawLine(dst, v1.x, v1.y, v2.x, v2.y, color);
ImageDrawLine(dst, v2.x, v2.y, v3.x, v3.y, color);
ImageDrawLine(dst, v3.x, v3.y, v1.x, v1.y, color);
ImageDrawLine(dst, (int)v1.x, (int)v1.y, (int)v2.x, (int)v2.y, color);
ImageDrawLine(dst, (int)v2.x, (int)v2.y, (int)v3.x, (int)v3.y, color);
ImageDrawLine(dst, (int)v3.x, (int)v3.y, (int)v1.x, (int)v1.y, color);
}
// Draw a triangle fan defined by points within an image (first vertex is the center)