[Examples] Warning fixes (pt 1) (#1668)

* Fix some warnings in examples.

* cleanups from review

Co-authored-by: Jeffery Myers <JefMyers@blizzard.com>
This commit is contained in:
Jeffery Myers 2021-03-22 23:51:52 -07:00 committed by GitHub
parent c6dd41495b
commit e48b9a6da1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 104 additions and 103 deletions

View file

@ -35,7 +35,7 @@ int main(void)
for (int i = 0; i < MAX_COLORS_COUNT; i++)
{
colorsRecs[i].x = 10 + 30*i + 2*i;
colorsRecs[i].x = 10 + 30.0f*i + 2*i;
colorsRecs[i].y = 10;
colorsRecs[i].width = 30;
colorsRecs[i].height = 30;
@ -44,7 +44,7 @@ int main(void)
int colorSelected = 0;
int colorSelectedPrev = colorSelected;
int colorMouseHover = 0;
int brushSize = 20;
float brushSize = 20.0f;
bool mouseWasPressed = false;
Rectangle btnSaveRec = { 750, 10, 40, 30 };
@ -113,7 +113,7 @@ int main(void)
// NOTE: To avoid discontinuous circles, we could store
// previous-next mouse points and just draw a line using brush size
BeginTextureMode(target);
if (mousePos.y > 50) DrawCircle(mousePos.x, mousePos.y, brushSize, colors[colorSelected]);
if (mousePos.y > 50) DrawCircle((int)mousePos.x, (int)mousePos.y, brushSize, colors[colorSelected]);
EndTextureMode();
}
@ -129,7 +129,7 @@ int main(void)
// Erase circle from render texture
BeginTextureMode(target);
if (mousePos.y > 50) DrawCircle(mousePos.x, mousePos.y, brushSize, colors[0]);
if (mousePos.y > 50) DrawCircle((int)mousePos.x, (int)mousePos.y, brushSize, colors[0]);
EndTextureMode();
}
else if (IsMouseButtonReleased(MOUSE_RIGHT_BUTTON) && mouseWasPressed)
@ -172,7 +172,7 @@ int main(void)
ClearBackground(RAYWHITE);
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
DrawTextureRec(target.texture, (Rectangle) { 0, 0, target.texture.width, -target.texture.height }, (Vector2) { 0, 0 }, WHITE);
DrawTextureRec(target.texture, (Rectangle) { 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2) { 0, 0 }, WHITE);
// Draw drawing circle for reference
if (mousePos.y > 50)