[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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 60 additions and 58 deletions

View file

@ -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);