[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:
parent
4311db5ba5
commit
e96bab7ce6
15 changed files with 60 additions and 58 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ int main(void)
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
boxPositionY -= (GetMouseWheelMove()*scrollSpeed);
|
||||
boxPositionY -= (int)(GetMouseWheelMove()*scrollSpeed);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue