mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-25 00:29:18 -05:00
Refactor int to float missing parse (#5503)
* refactor int to float parse * Reverting as requested --------- Co-authored-by: Maicon <maicon@thinkpad02.exads.com>
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user