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/core/core_random_sequence.c | |
| 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/core/core_random_sequence.c')
| -rw-r--r-- | examples/core/core_random_sequence.c | 16 |
1 files changed, 8 insertions, 8 deletions
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); |
