From afe74c1c707a7c0d9499fb63f0120466c719c6fe Mon Sep 17 00:00:00 2001 From: Maicon Santana Date: Sat, 24 Jan 2026 20:53:22 +0000 Subject: [PATCH] Refactor int to float missing parse (#5503) * refactor int to float parse * Reverting as requested --------- Co-authored-by: Maicon --- examples/core/core_2d_camera_platformer.c | 8 ++--- examples/core/core_automation_events.c | 8 ++--- examples/core/core_viewport_scaling.c | 4 +-- examples/models/models_rlgl_solar_system.c | 36 +++++++++---------- examples/models/models_waving_cubes.c | 6 ++-- examples/shaders/shaders_game_of_life.c | 4 +-- examples/shapes/shapes_colors_palette.c | 2 +- examples/shapes/shapes_digital_clock.c | 2 +- examples/shapes/shapes_double_pendulum.c | 8 ++--- examples/text/text_font_sdf.c | 4 +-- examples/text/text_rectangle_bounds.c | 6 ++-- examples/text/text_unicode_emojis.c | 8 ++--- examples/text/text_words_alignment.c | 2 +- examples/textures/textures_bunnymark.c | 8 ++--- .../textures/textures_cellular_automata.c | 2 +- examples/textures/textures_fog_of_war.c | 4 +-- examples/textures/textures_image_processing.c | 2 +- examples/textures/textures_image_text.c | 2 +- examples/textures/textures_sprite_button.c | 2 +- examples/textures/textures_sprite_explosion.c | 4 +-- src/rtextures.c | 2 +- 21 files changed, 62 insertions(+), 62 deletions(-) diff --git a/examples/core/core_2d_camera_platformer.c b/examples/core/core_2d_camera_platformer.c index 45bad4015..49d0a940c 100644 --- a/examples/core/core_2d_camera_platformer.c +++ b/examples/core/core_2d_camera_platformer.c @@ -226,10 +226,10 @@ void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envI Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, *camera); Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, *camera); - if (max.x < width) camera->offset.x = width - (max.x - width/2); - if (max.y < height) camera->offset.y = height - (max.y - height/2); - if (min.x > 0) camera->offset.x = width/2 - min.x; - if (min.y > 0) camera->offset.y = height/2 - min.y; + if (max.x < width) camera->offset.x = width - (max.x - (float)width/2); + if (max.y < height) camera->offset.y = height - (max.y - (float)height/2); + if (min.x > 0) camera->offset.x = (float)width/2 - min.x; + if (min.y > 0) camera->offset.y = (float)height/2 - min.y; } void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height) diff --git a/examples/core/core_automation_events.c b/examples/core/core_automation_events.c index b98b37c69..50204187f 100644 --- a/examples/core/core_automation_events.c +++ b/examples/core/core_automation_events.c @@ -225,10 +225,10 @@ int main(void) Vector2 max = GetWorldToScreen2D((Vector2){ maxX, maxY }, camera); Vector2 min = GetWorldToScreen2D((Vector2){ minX, minY }, camera); - if (max.x < screenWidth) camera.offset.x = screenWidth - (max.x - screenWidth/2); - if (max.y < screenHeight) camera.offset.y = screenHeight - (max.y - screenHeight/2); - if (min.x > 0) camera.offset.x = screenWidth/2 - min.x; - if (min.y > 0) camera.offset.y = screenHeight/2 - min.y; + if (max.x < screenWidth) camera.offset.x = screenWidth - (max.x - (float)screenWidth/2); + if (max.y < screenHeight) camera.offset.y = screenHeight - (max.y - (float)screenHeight/2); + if (min.x > 0) camera.offset.x = (float)screenWidth/2 - min.x; + if (min.y > 0) camera.offset.y = (float)screenHeight/2 - min.y; //---------------------------------------------------------------------------------- // Events management diff --git a/examples/core/core_viewport_scaling.c b/examples/core/core_viewport_scaling.c index 6ff5ac9c4..4a608e96d 100644 --- a/examples/core/core_viewport_scaling.c +++ b/examples/core/core_viewport_scaling.c @@ -216,7 +216,7 @@ static void KeepAspectCenteredInteger(int screenWidth, int screenHeight, int gam static void KeepHeightCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect) { - const float resizeRatio = (float)(screenHeight/gameHeight); + const float resizeRatio = (float)screenHeight/gameHeight; sourceRect->x = 0.0f; sourceRect->y = 0.0f; sourceRect->width = (float)(int)(screenWidth/resizeRatio); @@ -230,7 +230,7 @@ static void KeepHeightCenteredInteger(int screenWidth, int screenHeight, int gam static void KeepWidthCenteredInteger(int screenWidth, int screenHeight, int gameWidth, int gameHeight, Rectangle *sourceRect, Rectangle *destRect) { - const float resizeRatio = (float)(screenWidth/gameWidth); + const float resizeRatio = (float)screenWidth/gameWidth; sourceRect->x = 0.0f; sourceRect->y = 0.0f; sourceRect->width = (float)gameWidth; diff --git a/examples/models/models_rlgl_solar_system.c b/examples/models/models_rlgl_solar_system.c index d8d86d69a..0988ede8d 100644 --- a/examples/models/models_rlgl_solar_system.c +++ b/examples/models/models_rlgl_solar_system.c @@ -148,25 +148,25 @@ void DrawSphereBasic(Color color) { for (int j = 0; j < slices; j++) { - rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*i))*sinf(DEG2RAD*(j*360/slices)), - sinf(DEG2RAD*(270+(180/(rings + 1))*i)), - cosf(DEG2RAD*(270+(180/(rings + 1))*i))*cosf(DEG2RAD*(j*360/slices))); - rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360/slices)), - sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))), - cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360/slices))); - rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*(j*360/slices)), - sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))), - cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*(j*360/slices))); + rlVertex3f(cosf(DEG2RAD*(270+(180.0f/(rings + 1))*i))*sinf(DEG2RAD*(j*360.0f/slices)), + sinf(DEG2RAD*(270+(180.0f/(rings + 1))*i)), + cosf(DEG2RAD*(270+(180.0f/(rings + 1))*i))*cosf(DEG2RAD*(j*360.0f/slices))); + rlVertex3f(cosf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360.0f/slices)), + sinf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1))), + cosf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360.0f/slices))); + rlVertex3f(cosf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1)))*sinf(DEG2RAD*(j*360.0f/slices)), + sinf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1))), + cosf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1)))*cosf(DEG2RAD*(j*360.0f/slices))); - rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*i))*sinf(DEG2RAD*(j*360/slices)), - sinf(DEG2RAD*(270+(180/(rings + 1))*i)), - cosf(DEG2RAD*(270+(180/(rings + 1))*i))*cosf(DEG2RAD*(j*360/slices))); - rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i)))*sinf(DEG2RAD*((j+1)*360/slices)), - sinf(DEG2RAD*(270+(180/(rings + 1))*(i))), - cosf(DEG2RAD*(270+(180/(rings + 1))*(i)))*cosf(DEG2RAD*((j+1)*360/slices))); - rlVertex3f(cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360/slices)), - sinf(DEG2RAD*(270+(180/(rings + 1))*(i+1))), - cosf(DEG2RAD*(270+(180/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360/slices))); + rlVertex3f(cosf(DEG2RAD*(270+(180.0f/(rings + 1))*i))*sinf(DEG2RAD*(j*360.0f/slices)), + sinf(DEG2RAD*(270+(180.0f/(rings + 1))*i)), + cosf(DEG2RAD*(270+(180.0f/(rings + 1))*i))*cosf(DEG2RAD*(j*360.0f/slices))); + rlVertex3f(cosf(DEG2RAD*(270+(180.0f/(rings + 1))*(i)))*sinf(DEG2RAD*((j+1)*360.0f/slices)), + sinf(DEG2RAD*(270+(180.0f/(rings + 1))*(i))), + cosf(DEG2RAD*(270+(180.0f/(rings + 1))*(i)))*cosf(DEG2RAD*((j+1)*360.0f/slices))); + rlVertex3f(cosf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1)))*sinf(DEG2RAD*((j+1)*360.0f/slices)), + sinf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1))), + cosf(DEG2RAD*(270+(180.0f/(rings + 1))*(i+1)))*cosf(DEG2RAD*((j+1)*360.0f/slices))); } } rlEnd(); diff --git a/examples/models/models_waving_cubes.c b/examples/models/models_waving_cubes.c index 7996c1c8a..36e8bccf7 100644 --- a/examples/models/models_waving_cubes.c +++ b/examples/models/models_waving_cubes.c @@ -85,9 +85,9 @@ int main(void) // Calculate the cube position Vector3 cubePos = { - (float)(x - numBlocks/2)*(scale*3.0f) + scatter, - (float)(y - numBlocks/2)*(scale*2.0f) + scatter, - (float)(z - numBlocks/2)*(scale*3.0f) + scatter + (float)(x - (float)numBlocks/2)*(scale*3.0f) + scatter, + (float)(y - (float)numBlocks/2)*(scale*2.0f) + scatter, + (float)(z - (float)numBlocks/2)*(scale*3.0f) + scatter }; // Pick a color with a hue depending on cube position for the rainbow color effect diff --git a/examples/shaders/shaders_game_of_life.c b/examples/shaders/shaders_game_of_life.c index 9b9242a0d..0ae91b756 100644 --- a/examples/shaders/shaders_game_of_life.c +++ b/examples/shaders/shaders_game_of_life.c @@ -258,8 +258,8 @@ int main(void) UnloadImage(pattern); mode = MODE_PAUSE; - offsetX = worldWidth*presetPatterns[preset].position.x - windowWidth/zoom/2.0f; - offsetY = worldHeight*presetPatterns[preset].position.y - windowHeight/zoom/2.0f; + offsetX = worldWidth*presetPatterns[preset].position.x - (float)windowWidth/zoom/2.0f; + offsetY = worldHeight*presetPatterns[preset].position.y - (float)windowHeight/zoom/2.0f; } // Check window draw inside world limits diff --git a/examples/shapes/shapes_colors_palette.c b/examples/shapes/shapes_colors_palette.c index 9fbcf3063..44da323eb 100644 --- a/examples/shapes/shapes_colors_palette.c +++ b/examples/shapes/shapes_colors_palette.c @@ -45,7 +45,7 @@ int main(void) for (int i = 0; i < MAX_COLORS_COUNT; i++) { colorsRecs[i].x = 20.0f + 100.0f *(i%7) + 10.0f *(i%7); - colorsRecs[i].y = 80.0f + 100.0f *(i/7) + 10.0f *(i/7); + colorsRecs[i].y = 80.0f + 100.0f *((float)i/7) + 10.0f *((float)i/7); colorsRecs[i].width = 100.0f; colorsRecs[i].height = 100.0f; } diff --git a/examples/shapes/shapes_digital_clock.c b/examples/shapes/shapes_digital_clock.c index cca3f3c44..fb9ae80e6 100644 --- a/examples/shapes/shapes_digital_clock.c +++ b/examples/shapes/shapes_digital_clock.c @@ -311,7 +311,7 @@ static void DrawDisplaySegment(Vector2 center, int length, int thick, bool verti (Vector2){ center.x + thick/2.0f, center.y - length/2.0f }, // Point 3 (Vector2){ center.x - thick/2.0f, center.y + length/2.0f }, // Point 4 (Vector2){ center.x + thick/2.0f, center.y + length/2.0f }, // Point 5 - (Vector2){ center.x, center.y + length/2 + thick/2.0f }, // Point 6 + (Vector2){ center.x, center.y + (float)length/2 + thick/2.0f }, // Point 6 }; DrawTriangleStrip(segmentPointsV, 6, color); diff --git a/examples/shapes/shapes_double_pendulum.c b/examples/shapes/shapes_double_pendulum.c index 760d66203..5b357c9f3 100644 --- a/examples/shapes/shapes_double_pendulum.c +++ b/examples/shapes/shapes_double_pendulum.c @@ -49,8 +49,8 @@ int main(void) float totalM = m1 + m2; Vector2 previousPosition = CalculateDoublePendulumEndPoint(l1, theta1, l2, theta2); - previousPosition.x += (screenWidth/2); - previousPosition.y += (screenHeight/2 - 100); + previousPosition.x += ((float)screenWidth/2); + previousPosition.y += ((float)screenHeight/2 - 100); // Scale length float L1 = l1*lengthScaler; @@ -105,8 +105,8 @@ int main(void) // Calculate position Vector2 currentPosition = CalculateDoublePendulumEndPoint(l1, theta1, l2, theta2); - currentPosition.x += screenWidth/2; - currentPosition.y += screenHeight/2 - 100; + currentPosition.x += (float)screenWidth/2; + currentPosition.y += (float)screenHeight/2 - 100; // Draw to render texture BeginTextureMode(target); diff --git a/examples/text/text_font_sdf.c b/examples/text/text_font_sdf.c index 744450fa6..42b7495e2 100644 --- a/examples/text/text_font_sdf.c +++ b/examples/text/text_font_sdf.c @@ -97,8 +97,8 @@ int main(void) if (currentFont == 0) textSize = MeasureTextEx(fontDefault, msg, fontSize, 0); else textSize = MeasureTextEx(fontSDF, msg, fontSize, 0); - fontPosition.x = GetScreenWidth()/2 - textSize.x/2; - fontPosition.y = GetScreenHeight()/2 - textSize.y/2 + 80; + fontPosition.x = (float)GetScreenWidth()/2 - textSize.x/2; + fontPosition.y = (float)GetScreenHeight()/2 - textSize.y/2 + 80; //---------------------------------------------------------------------------------- // Draw diff --git a/examples/text/text_rectangle_bounds.c b/examples/text/text_rectangle_bounds.c index e180ae475..b87a3a956 100644 --- a/examples/text/text_rectangle_bounds.c +++ b/examples/text/text_rectangle_bounds.c @@ -226,7 +226,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, { if (!wordWrap) { - textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor; + textOffsetY += (font.baseSize + (float)font.baseSize/2)*scaleFactor; textOffsetX = 0; } } @@ -234,7 +234,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, { if (!wordWrap && ((textOffsetX + glyphWidth) > rec.width)) { - textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor; + textOffsetY += (font.baseSize + (float)font.baseSize/2)*scaleFactor; textOffsetX = 0; } @@ -258,7 +258,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, if (wordWrap && (i == endLine)) { - textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor; + textOffsetY += (font.baseSize + (float)font.baseSize/2)*scaleFactor; textOffsetX = 0; startLine = endLine; endLine = -1; diff --git a/examples/text/text_unicode_emojis.c b/examples/text/text_unicode_emojis.c index 00712745d..240b50052 100644 --- a/examples/text/text_unicode_emojis.c +++ b/examples/text/text_unicode_emojis.c @@ -277,7 +277,7 @@ int main(void) DrawTriangle(a, b, c, emoji[selected].color); // Draw the main text message - Rectangle textRect = { msgRect.x + horizontalPadding/2, msgRect.y + verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height }; + Rectangle textRect = { msgRect.x + (float)horizontalPadding/2, msgRect.y + (float)verticalPadding/2, msgRect.width - horizontalPadding, msgRect.height }; DrawTextBoxed(*font, messages[message].text, textRect, (float)font->baseSize, 1.0f, true, WHITE); // Draw the info text below the main message @@ -421,7 +421,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, { if (!wordWrap) { - textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor; + textOffsetY += (font.baseSize + (float)font.baseSize/2)*scaleFactor; textOffsetX = 0; } } @@ -429,7 +429,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, { if (!wordWrap && ((textOffsetX + glyphWidth) > rec.width)) { - textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor; + textOffsetY += (font.baseSize + (float)font.baseSize/2)*scaleFactor; textOffsetX = 0; } @@ -453,7 +453,7 @@ static void DrawTextBoxedSelectable(Font font, const char *text, Rectangle rec, if (wordWrap && (i == endLine)) { - textOffsetY += (font.baseSize + font.baseSize/2)*scaleFactor; + textOffsetY += (font.baseSize + (float)font.baseSize/2)*scaleFactor; textOffsetX = 0; startLine = endLine; endLine = -1; diff --git a/examples/text/text_words_alignment.c b/examples/text/text_words_alignment.c index dbd9cd03e..f7ffa74af 100644 --- a/examples/text/text_words_alignment.c +++ b/examples/text/text_words_alignment.c @@ -41,7 +41,7 @@ int main(void) InitWindow(screenWidth, screenHeight, "raylib [text] example - words alignment"); // Define the rectangle we will draw the text in - Rectangle textContainerRect = (Rectangle){ screenWidth/2-screenWidth/4, screenHeight/2-screenHeight/3, screenWidth/2, screenHeight*2/3 }; + Rectangle textContainerRect = (Rectangle){ (float)screenWidth/2-(float)screenWidth/4, (float)screenHeight/2-(float)screenHeight/3, (float)screenWidth/2, (float)screenHeight*2/3 }; // Some text to display the current alignment const char *textAlignNameH[] = { "Left", "Centre", "Right" }; diff --git a/examples/textures/textures_bunnymark.c b/examples/textures/textures_bunnymark.c index a95181ed6..3279abb8f 100644 --- a/examples/textures/textures_bunnymark.c +++ b/examples/textures/textures_bunnymark.c @@ -83,10 +83,10 @@ int main(void) bunnies[i].position.x += bunnies[i].speed.x; bunnies[i].position.y += bunnies[i].speed.y; - if (((bunnies[i].position.x + texBunny.width/2) > GetScreenWidth()) || - ((bunnies[i].position.x + texBunny.width/2) < 0)) bunnies[i].speed.x *= -1; - if (((bunnies[i].position.y + texBunny.height/2) > GetScreenHeight()) || - ((bunnies[i].position.y + texBunny.height/2 - 40) < 0)) bunnies[i].speed.y *= -1; + if (((bunnies[i].position.x + (float)texBunny.width/2) > GetScreenWidth()) || + ((bunnies[i].position.x + (float)texBunny.width/2) < 0)) bunnies[i].speed.x *= -1; + if (((bunnies[i].position.y + (float)texBunny.height/2) > GetScreenHeight()) || + ((bunnies[i].position.y + (float)texBunny.height/2 - 40) < 0)) bunnies[i].speed.y *= -1; } //---------------------------------------------------------------------------------- diff --git a/examples/textures/textures_cellular_automata.c b/examples/textures/textures_cellular_automata.c index affeeda93..802de3611 100644 --- a/examples/textures/textures_cellular_automata.c +++ b/examples/textures/textures_cellular_automata.c @@ -165,7 +165,7 @@ int main(void) // If the mouse is on this preset, highlight it if (mouseInCell == i + 8) - DrawRectangleLinesEx((Rectangle) { 2 + (presetsSizeX + 2.0f)*(i/2), + DrawRectangleLinesEx((Rectangle) { 2 + (presetsSizeX + 2.0f)*((float)i/2), (presetsSizeY + 2.0f)*(i%2), presetsSizeX + 4.0f, presetsSizeY + 4.0f }, 3, RED); } diff --git a/examples/textures/textures_fog_of_war.c b/examples/textures/textures_fog_of_war.c index 4733caeb4..ea98b03ce 100644 --- a/examples/textures/textures_fog_of_war.c +++ b/examples/textures/textures_fog_of_war.c @@ -93,8 +93,8 @@ int main(void) for (unsigned int i = 0; i < map.tilesX*map.tilesY; i++) if (map.tileFog[i] == 1) map.tileFog[i] = 2; // Get current tile position from player pixel position - playerTileX = (int)((playerPosition.x + MAP_TILE_SIZE/2)/MAP_TILE_SIZE); - playerTileY = (int)((playerPosition.y + MAP_TILE_SIZE/2)/MAP_TILE_SIZE); + playerTileX = (int)((playerPosition.x + (float)MAP_TILE_SIZE/2)/MAP_TILE_SIZE); + playerTileY = (int)((playerPosition.y + (float)MAP_TILE_SIZE/2)/MAP_TILE_SIZE); // Check visibility and update fog // NOTE: We check tilemap limits to avoid processing tiles out-of-array-bounds (it could crash program) diff --git a/examples/textures/textures_image_processing.c b/examples/textures/textures_image_processing.c index 474974f97..8d2472c0a 100644 --- a/examples/textures/textures_image_processing.c +++ b/examples/textures/textures_image_processing.c @@ -156,7 +156,7 @@ int main(void) { DrawRectangleRec(toggleRecs[i], ((i == currentProcess) || (i == mouseHoverRec)) ? SKYBLUE : LIGHTGRAY); DrawRectangleLines((int)toggleRecs[i].x, (int) toggleRecs[i].y, (int) toggleRecs[i].width, (int) toggleRecs[i].height, ((i == currentProcess) || (i == mouseHoverRec)) ? BLUE : GRAY); - DrawText( processText[i], (int)( toggleRecs[i].x + toggleRecs[i].width/2 - MeasureText(processText[i], 10)/2), (int) toggleRecs[i].y + 11, 10, ((i == currentProcess) || (i == mouseHoverRec)) ? DARKBLUE : DARKGRAY); + DrawText( processText[i], (int)( toggleRecs[i].x + toggleRecs[i].width/2 - (float)MeasureText(processText[i], 10)/2), (int) toggleRecs[i].y + 11, 10, ((i == currentProcess) || (i == mouseHoverRec)) ? DARKBLUE : DARKGRAY); } DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE); diff --git a/examples/textures/textures_image_text.c b/examples/textures/textures_image_text.c index e6777261a..b71ca4792 100644 --- a/examples/textures/textures_image_text.c +++ b/examples/textures/textures_image_text.c @@ -38,7 +38,7 @@ int main(void) Texture2D texture = LoadTextureFromImage(parrots); // Image converted to texture, uploaded to GPU memory (VRAM) UnloadImage(parrots); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM - Vector2 position = { (float)(screenWidth/2 - texture.width/2), (float)(screenHeight/2 - texture.height/2 - 20) }; + Vector2 position = { (float)screenWidth/2 - (float)texture.width/2, (float)screenHeight/2 - (float)texture.height/2 - 20 }; bool showFont = false; diff --git a/examples/textures/textures_sprite_button.c b/examples/textures/textures_sprite_button.c index a7db93c4f..7fe2adfd6 100644 --- a/examples/textures/textures_sprite_button.c +++ b/examples/textures/textures_sprite_button.c @@ -39,7 +39,7 @@ int main(void) Rectangle sourceRec = { 0, 0, (float)button.width, frameHeight }; // Define button bounds on screen - Rectangle btnBounds = { screenWidth/2.0f - button.width/2.0f, screenHeight/2.0f - button.height/NUM_FRAMES/2.0f, (float)button.width, frameHeight }; + Rectangle btnBounds = { screenWidth/2.0f - button.width/2.0f, screenHeight/2.0f - (float)button.height/NUM_FRAMES/2.0f, (float)button.width, frameHeight }; int btnState = 0; // Button state: 0-NORMAL, 1-MOUSE_HOVER, 2-PRESSED bool btnAction = false; // Button action should be activated diff --git a/examples/textures/textures_sprite_explosion.c b/examples/textures/textures_sprite_explosion.c index fe9669224..7efe8cf17 100644 --- a/examples/textures/textures_sprite_explosion.c +++ b/examples/textures/textures_sprite_explosion.c @@ -39,8 +39,8 @@ int main(void) Texture2D explosion = LoadTexture("resources/explosion.png"); // Init variables for animation - float frameWidth = (float)(explosion.width/NUM_FRAMES_PER_LINE); // Sprite one frame rectangle width - float frameHeight = (float)(explosion.height/NUM_LINES); // Sprite one frame rectangle height + float frameWidth = (float)explosion.width/NUM_FRAMES_PER_LINE; // Sprite one frame rectangle width + float frameHeight = (float)explosion.height/NUM_LINES; // Sprite one frame rectangle height int currentFrame = 0; int currentLine = 0; diff --git a/src/rtextures.c b/src/rtextures.c index a20b5e516..a57f9037d 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -5602,4 +5602,4 @@ static Vector4 *LoadImageDataNormalized(Image image) return pixels; } -#endif // SUPPORT_MODULE_RTEXTURES +#endif // SUPPORT_MODULE_RTEXTURES \ No newline at end of file