[Examples] Fix typecast warnings in examples. (#1601)
* Fixing typecast warnings generated by visual studio 2019 in examples. * Changes to fixes based on feedback Co-authored-by: Jeffery Myers <JefMyers@blizzard.com>
This commit is contained in:
parent
82cdd88ffe
commit
48a7cd3c87
15 changed files with 57 additions and 54 deletions
|
@ -30,19 +30,19 @@ int main(void)
|
|||
|
||||
for (int i = 0; i < MAX_BUILDINGS; i++)
|
||||
{
|
||||
buildings[i].width = GetRandomValue(50, 200);
|
||||
buildings[i].height = GetRandomValue(100, 800);
|
||||
buildings[i].y = screenHeight - 130 - buildings[i].height;
|
||||
buildings[i].x = -6000 + spacing;
|
||||
buildings[i].width = (float)GetRandomValue(50, 200);
|
||||
buildings[i].height = (float)GetRandomValue(100, 800);
|
||||
buildings[i].y = screenHeight - 130.0f - buildings[i].height;
|
||||
buildings[i].x = -6000.0f + spacing;
|
||||
|
||||
spacing += buildings[i].width;
|
||||
spacing += (int)buildings[i].width;
|
||||
|
||||
buildColors[i] = (Color){ GetRandomValue(200, 240), GetRandomValue(200, 240), GetRandomValue(200, 250), 255 };
|
||||
}
|
||||
|
||||
Camera2D camera = { 0 };
|
||||
camera.target = (Vector2){ player.x + 20, player.y + 20 };
|
||||
camera.offset = (Vector2){ screenWidth/2, screenHeight/2 };
|
||||
camera.target = (Vector2){ player.x + 20.0f, player.y + 20.0f };
|
||||
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
|
||||
camera.rotation = 0.0f;
|
||||
camera.zoom = 1.0f;
|
||||
|
||||
|
@ -98,8 +98,8 @@ int main(void)
|
|||
|
||||
DrawRectangleRec(player, RED);
|
||||
|
||||
DrawLine(camera.target.x, -screenHeight*10, camera.target.x, screenHeight*10, GREEN);
|
||||
DrawLine(-screenWidth*10, camera.target.y, screenWidth*10, camera.target.y, GREEN);
|
||||
DrawLine((int)camera.target.x, -screenHeight*10, (int)camera.target.x, screenHeight*10, GREEN);
|
||||
DrawLine(-screenWidth*10, (int)camera.target.y, screenWidth*10, (int)camera.target.y, GREEN);
|
||||
|
||||
EndMode2D();
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ int main(void)
|
|||
|
||||
Camera2D camera = { 0 };
|
||||
camera.target = player.position;
|
||||
camera.offset = (Vector2){ screenWidth/2, screenHeight/2 };
|
||||
camera.offset = (Vector2){ screenWidth/2.0f, screenHeight/2.0f };
|
||||
camera.rotation = 0.0f;
|
||||
camera.zoom = 1.0f;
|
||||
|
||||
|
@ -191,14 +191,14 @@ void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float d
|
|||
|
||||
void UpdateCameraCenter(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||
{
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||
camera->target = player->position;
|
||||
}
|
||||
|
||||
void UpdateCameraCenterInsideMap(Camera2D *camera, Player *player, EnvItem *envItems, int envItemsLength, float delta, int width, int height)
|
||||
{
|
||||
camera->target = player->position;
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||
float minX = 1000, minY = 1000, maxX = -1000, maxY = -1000;
|
||||
|
||||
for (int i = 0; i < envItemsLength; i++)
|
||||
|
@ -225,7 +225,7 @@ void UpdateCameraCenterSmoothFollow(Camera2D *camera, Player *player, EnvItem *e
|
|||
static float minEffectLength = 10;
|
||||
static float fractionSpeed = 0.8f;
|
||||
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||
Vector2 diff = Vector2Subtract(player->position, camera->target);
|
||||
float length = Vector2Length(diff);
|
||||
|
||||
|
@ -242,7 +242,7 @@ void UpdateCameraEvenOutOnLanding(Camera2D *camera, Player *player, EnvItem *env
|
|||
static int eveningOut = false;
|
||||
static float evenOutTarget;
|
||||
|
||||
camera->offset = (Vector2){ width/2, height/2 };
|
||||
camera->offset = (Vector2){ width/2.0f, height/2.0f };
|
||||
camera->target.x = player->position.x;
|
||||
|
||||
if (eveningOut)
|
||||
|
|
|
@ -38,7 +38,7 @@ int main(void)
|
|||
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||
{
|
||||
heights[i] = (float)GetRandomValue(1, 12);
|
||||
positions[i] = (Vector3){ GetRandomValue(-15, 15), heights[i]/2, GetRandomValue(-15, 15) };
|
||||
positions[i] = (Vector3){ (float)GetRandomValue(-15, 15), heights[i]/2.0f, (float)GetRandomValue(-15, 15) };
|
||||
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ int main(void)
|
|||
|
||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, DARKGRAY);
|
||||
|
||||
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, screenHeight * 0.1f, 30, GREEN);
|
||||
if(collision) DrawText("BOX SELECTED", (screenWidth - MeasureText("BOX SELECTED", 30)) / 2, (int)(screenHeight * 0.1f), 30, GREEN);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue