Merge pull request #618 from kimkulling/fix_compiler_warnings

Fix compiler warnings
This commit is contained in:
Ray 2018-08-06 20:43:28 +02:00 committed by GitHub
commit 61b32e45ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 131 additions and 130 deletions

View file

@ -59,7 +59,7 @@ int main()
Rectangle selectRecs[NUM_PROCESSES];
for (int i = 0; i < NUM_PROCESSES; i++) selectRecs[i] = (Rectangle){ 40, 50 + 32*i, 150, 30 };
for (int i = 0; i < NUM_PROCESSES; i++) selectRecs[i] = (Rectangle){ 40.0f, (float)(50 + 32*i), 150.0f, 30.0f };
SetTargetFPS(60);
//---------------------------------------------------------------------------------------
@ -122,8 +122,8 @@ int main()
for (int i = 0; i < NUM_PROCESSES; i++)
{
DrawRectangleRec(selectRecs[i], (i == currentProcess) ? SKYBLUE : LIGHTGRAY);
DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, (i == currentProcess) ? BLUE : GRAY);
DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2, selectRecs[i].y + 11, 10, (i == currentProcess) ? DARKBLUE : DARKGRAY);
DrawRectangleLines((int)selectRecs[i].x, (int) selectRecs[i].y, (int) selectRecs[i].width, (int) selectRecs[i].height, (i == currentProcess) ? BLUE : GRAY);
DrawText( processText[i], (int)( selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2), (int) selectRecs[i].y + 11, 10, (i == currentProcess) ? DARKBLUE : DARKGRAY);
}
DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE);

View file

@ -26,12 +26,12 @@ int main()
Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
// Draw over image using custom font
ImageDrawTextEx(&parrots, (Vector2){ 20, 20 }, font, "[Parrots font drawing]", font.baseSize, 0, WHITE);
ImageDrawTextEx(&parrots, (Vector2){ 20.0f, 20.0f }, font, "[Parrots font drawing]", (float)font.baseSize, 0.0f, WHITE);
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 = { screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2 - 20 };
Vector2 position = { (float)(screenWidth/2 - texture.width/2), (float)(screenHeight/2 - texture.height/2 - 20) };
bool showFont = false;
@ -60,7 +60,7 @@ int main()
// Draw text directly using sprite font
DrawTextEx(font, "[Parrots font drawing]", (Vector2){ position.x + 20,
position.y + 20 + 280 }, font.baseSize, 0, WHITE);
position.y + 20 + 280 }, (float)font.baseSize, 0.0f, WHITE);
}
else DrawTexture(font.texture, screenWidth/2 - font.texture.width/2, 50, BLACK);

View file

@ -42,7 +42,7 @@ int main()
mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
mouseTail[i].alpha = 1.0f;
mouseTail[i].size = (float)GetRandomValue(1, 30)/20.0f;
mouseTail[i].rotation = GetRandomValue(0, 360);
mouseTail[i].rotation = (float) GetRandomValue(0, 360);
mouseTail[i].active = false;
}
@ -107,9 +107,9 @@ int main()
// Draw active particles
for (int i = 0; i < MAX_PARTICLES; i++)
{
if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0, 0, smoke.width, smoke.height },
if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ 0.0f, 0.0f, (float) smoke.width, (float) smoke.height },
(Rectangle){ mouseTail[i].position.x, mouseTail[i].position.y, smoke.width*mouseTail[i].size, smoke.height*mouseTail[i].size },
(Vector2){ smoke.width*mouseTail[i].size/2, smoke.height*mouseTail[i].size/2 }, mouseTail[i].rotation,
(Vector2){ (float) (smoke.width*mouseTail[i].size/2.0f), (float)(smoke.height*mouseTail[i].size/2.0f) }, mouseTail[i].rotation,
Fade(mouseTail[i].color, mouseTail[i].alpha));
}

View file

@ -27,13 +27,13 @@ int main()
int frameHeight = scarfy.height;
// NOTE: Source rectangle (part of the texture to use for drawing)
Rectangle sourceRec = { 0, 0, frameWidth, frameHeight };
Rectangle sourceRec = { 0.0f, 0.0f, (float)frameWidth, (float)frameHeight };
// NOTE: Destination rectangle (screen rectangle where drawing part of texture)
Rectangle destRec = { screenWidth/2, screenHeight/2, frameWidth*2, frameHeight*2 };
Rectangle destRec = { (float) screenWidth/2, (float)screenHeight/2, (float)frameWidth*2, (float)frameHeight*2 };
// NOTE: Origin of the texture (rotation/scale point), it's relative to destination rectangle size
Vector2 origin = { frameWidth, frameHeight };
Vector2 origin = { (float) frameWidth, (float) frameHeight };
int rotation = 0;
@ -59,10 +59,10 @@ int main()
// destRec defines the rectangle where our texture part will fit (scaling it to fit)
// origin defines the point of the texture used as reference for rotation and scaling
// rotation defines the texture rotation (using origin as rotation point)
DrawTexturePro(scarfy, sourceRec, destRec, origin, rotation, WHITE);
DrawTexturePro(scarfy, sourceRec, destRec, origin, (float)rotation, WHITE);
DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY);
DrawLine(0, destRec.y, screenWidth, destRec.y, GRAY);
DrawLine((int) destRec.x, 0, (int) destRec.x, screenHeight, GRAY);
DrawLine(0, (int)destRec.y, screenWidth, (int)destRec.y, GRAY);
DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY);