Fix compiler warnings, first part
This commit is contained in:
parent
d999e5a016
commit
ecf8bff4aa
7 changed files with 55 additions and 55 deletions
|
@ -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);
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
@ -123,7 +123,7 @@ int main()
|
|||
{
|
||||
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);
|
||||
DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2, selectRecs[i].y + 11, 10.0f, (i == currentProcess) ? DARKBLUE : DARKGRAY);
|
||||
}
|
||||
|
||||
DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
10
src/models.c
10
src/models.c
|
@ -1771,7 +1771,7 @@ void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float
|
|||
// Draw a billboard
|
||||
void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint)
|
||||
{
|
||||
Rectangle sourceRec = { 0, 0, texture.width, texture.height };
|
||||
Rectangle sourceRec = { 0.0f, 0.0f, (float)texture.width, (float)texture.height };
|
||||
|
||||
DrawBillboardRec(camera, texture, sourceRec, center, size, tint);
|
||||
}
|
||||
|
@ -1837,9 +1837,9 @@ void DrawBoundingBox(BoundingBox box, Color color)
|
|||
{
|
||||
Vector3 size;
|
||||
|
||||
size.x = fabs(box.max.x - box.min.x);
|
||||
size.y = fabs(box.max.y - box.min.y);
|
||||
size.z = fabs(box.max.z - box.min.z);
|
||||
size.x = (float)fabs(box.max.x - box.min.x);
|
||||
size.y = (float)fabs(box.max.y - box.min.y);
|
||||
size.z = (float)fabs(box.max.z - box.min.z);
|
||||
|
||||
Vector3 center = { box.min.x + size.x/2.0f, box.min.y + size.y/2.0f, box.min.z + size.z/2.0f };
|
||||
|
||||
|
@ -2206,9 +2206,9 @@ void MeshBinormals(Mesh *mesh)
|
|||
Vector3 tangent = { mesh->tangents[i*4 + 0], mesh->tangents[i*4 + 1], mesh->tangents[i*4 + 2] };
|
||||
float tangentW = mesh->tangents[i*4 + 3];
|
||||
|
||||
Vector3 binormal = Vector3Multiply(Vector3CrossProduct(normal, tangent), tangentW);
|
||||
|
||||
// TODO: Register computed binormal in mesh->binormal ?
|
||||
// Vector3 binormal = Vector3Multiply( Vector3CrossProduct( normal, tangent ), tangentW );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -296,12 +296,12 @@ RMDEF Vector3 Vector3Perpendicular(Vector3 v)
|
|||
{
|
||||
Vector3 result = { 0 };
|
||||
|
||||
float min = fabs(v.x);
|
||||
float min = (float) fabs(v.x);
|
||||
Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f};
|
||||
|
||||
if (fabs(v.y) < min)
|
||||
{
|
||||
min = fabs(v.y);
|
||||
min = (float) fabs(v.y);
|
||||
Vector3 tmp = {0.0f, 1.0f, 0.0f};
|
||||
cardinalAxis = tmp;
|
||||
}
|
||||
|
@ -840,28 +840,28 @@ RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top,
|
|||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
float rl = (right - left);
|
||||
float tb = (top - bottom);
|
||||
float fn = (far - near);
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(far - near);
|
||||
|
||||
result.m0 = (near*2.0f)/rl;
|
||||
result.m0 = ((float) near*2.0f)/rl;
|
||||
result.m1 = 0.0f;
|
||||
result.m2 = 0.0f;
|
||||
result.m3 = 0.0f;
|
||||
|
||||
result.m4 = 0.0f;
|
||||
result.m5 = (near*2.0f)/tb;
|
||||
result.m5 = ((float) near*2.0f)/tb;
|
||||
result.m6 = 0.0f;
|
||||
result.m7 = 0.0f;
|
||||
|
||||
result.m8 = (right + left)/rl;
|
||||
result.m9 = (top + bottom)/tb;
|
||||
result.m10 = -(far + near)/fn;
|
||||
result.m8 = ((float)right + (float)left)/rl;
|
||||
result.m9 = ((float)top + (float)bottom)/tb;
|
||||
result.m10 = -((float)far + (float)near)/fn;
|
||||
result.m11 = -1.0f;
|
||||
|
||||
result.m12 = 0.0f;
|
||||
result.m13 = 0.0f;
|
||||
result.m14 = -(far*near*2.0f)/fn;
|
||||
result.m14 = -((float)far*(float)near*2.0f)/fn;
|
||||
result.m15 = 0.0f;
|
||||
|
||||
return result;
|
||||
|
@ -899,9 +899,9 @@ RMDEF Matrix MatrixOrtho(double left, double right, double bottom, double top, d
|
|||
result.m9 = 0.0f;
|
||||
result.m10 = -2.0f/fn;
|
||||
result.m11 = 0.0f;
|
||||
result.m12 = -(left + right)/rl;
|
||||
result.m13 = -(top + bottom)/tb;
|
||||
result.m14 = -(far + near)/fn;
|
||||
result.m12 = -((float)left + (float)right)/rl;
|
||||
result.m13 = -((float)top + (float)bottom)/tb;
|
||||
result.m14 = -((float)far + (float)near)/fn;
|
||||
result.m15 = 1.0f;
|
||||
|
||||
return result;
|
||||
|
|
44
src/text.c
44
src/text.c
|
@ -220,12 +220,12 @@ extern void LoadDefaultFont(void)
|
|||
{
|
||||
defaultFont.chars[i].value = 32 + i; // First char is 32
|
||||
|
||||
defaultFont.chars[i].rec.x = currentPosX;
|
||||
defaultFont.chars[i].rec.y = charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
defaultFont.chars[i].rec.width = charsWidth[i];
|
||||
defaultFont.chars[i].rec.height = charsHeight;
|
||||
defaultFont.chars[i].rec.x = (float) currentPosX;
|
||||
defaultFont.chars[i].rec.y = (float) charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
defaultFont.chars[i].rec.width = (float) charsWidth[i];
|
||||
defaultFont.chars[i].rec.height = (float) charsHeight;
|
||||
|
||||
testPosX += (defaultFont.chars[i].rec.width + charsDivisor);
|
||||
testPosX += (int) (defaultFont.chars[i].rec.width + (float) charsDivisor);
|
||||
|
||||
if (testPosX >= defaultFont.texture.width)
|
||||
{
|
||||
|
@ -233,8 +233,8 @@ extern void LoadDefaultFont(void)
|
|||
currentPosX = 2*charsDivisor + charsWidth[i];
|
||||
testPosX = currentPosX;
|
||||
|
||||
defaultFont.chars[i].rec.x = charsDivisor;
|
||||
defaultFont.chars[i].rec.y = charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
defaultFont.chars[i].rec.x = (float)charsDivisor;
|
||||
defaultFont.chars[i].rec.y = (float)charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
}
|
||||
else currentPosX = testPosX;
|
||||
|
||||
|
@ -244,7 +244,7 @@ extern void LoadDefaultFont(void)
|
|||
defaultFont.chars[i].advanceX = 0;
|
||||
}
|
||||
|
||||
defaultFont.baseSize = defaultFont.chars[0].rec.height;
|
||||
defaultFont.baseSize = (int) defaultFont.chars[0].rec.height;
|
||||
|
||||
TraceLog(LOG_INFO, "[TEX ID %i] Default font loaded successfully", defaultFont.texture.id);
|
||||
}
|
||||
|
@ -361,14 +361,14 @@ CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int c
|
|||
if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) TraceLog(LOG_WARNING, "Failed to init font!");
|
||||
|
||||
// Calculate font scale factor
|
||||
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, fontSize);
|
||||
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float) fontSize);
|
||||
|
||||
// Calculate font basic metrics
|
||||
// NOTE: ascent is equivalent to font baseline
|
||||
int ascent, descent, lineGap;
|
||||
stbtt_GetFontVMetrics(&fontInfo, &ascent, &descent, &lineGap);
|
||||
ascent *= scaleFactor;
|
||||
descent *= scaleFactor;
|
||||
ascent *= (int) scaleFactor;
|
||||
descent *= (int) scaleFactor;
|
||||
|
||||
// Fill fontChars in case not provided externally
|
||||
// NOTE: By default we fill charsCount consecutevely, starting at 32 (Space)
|
||||
|
@ -407,7 +407,7 @@ CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int c
|
|||
TraceLog(LOG_DEBUG, "Character offsetY: %i", ascent + chY1);
|
||||
|
||||
stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL);
|
||||
chars[i].advanceX *= scaleFactor;
|
||||
chars[i].advanceX *= (int) scaleFactor;
|
||||
}
|
||||
|
||||
free(fontBuffer);
|
||||
|
@ -460,8 +460,8 @@ Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int paddi
|
|||
}
|
||||
}
|
||||
|
||||
chars[i].rec.x = offsetX;
|
||||
chars[i].rec.y = offsetY;
|
||||
chars[i].rec.x = (float) offsetX;
|
||||
chars[i].rec.y = (float) offsetY;
|
||||
|
||||
// Move atlas position X for next character drawing
|
||||
offsetX += ((int)chars[i].rec.width + 2*padding);
|
||||
|
@ -502,8 +502,8 @@ Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int paddi
|
|||
|
||||
for (int i = 0; i < charsCount; i++)
|
||||
{
|
||||
chars[i].rec.x = rects[i].x + padding;
|
||||
chars[i].rec.y = rects[i].y + padding;
|
||||
chars[i].rec.x = rects[i].x + (float) padding;
|
||||
chars[i].rec.y = rects[i].y + (float) padding;
|
||||
|
||||
if (rects[i].was_packed)
|
||||
{
|
||||
|
@ -834,15 +834,15 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
|
|||
{
|
||||
tempCharValues[index] = firstChar + index;
|
||||
|
||||
tempCharRecs[index].x = xPosToRead;
|
||||
tempCharRecs[index].y = lineSpacing + lineToRead*(charHeight + lineSpacing);
|
||||
tempCharRecs[index].height = charHeight;
|
||||
tempCharRecs[index].x = (float) xPosToRead;
|
||||
tempCharRecs[index].y = (float) (lineSpacing + lineToRead*(charHeight + lineSpacing));
|
||||
tempCharRecs[index].height = (float) charHeight;
|
||||
|
||||
int charWidth = 0;
|
||||
|
||||
while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
|
||||
|
||||
tempCharRecs[index].width = charWidth;
|
||||
tempCharRecs[index].width = (float) charWidth;
|
||||
|
||||
index++;
|
||||
|
||||
|
@ -887,7 +887,7 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
|
|||
spriteFont.chars[i].advanceX = 0;
|
||||
}
|
||||
|
||||
spriteFont.baseSize = spriteFont.chars[0].rec.height;
|
||||
spriteFont.baseSize = (int) spriteFont.chars[0].rec.height;
|
||||
|
||||
TraceLog(LOG_INFO, "Image file loaded correctly as Font");
|
||||
|
||||
|
@ -996,7 +996,7 @@ static Font LoadBMFont(const char *fileName)
|
|||
|
||||
// Save data properly in sprite font
|
||||
font.chars[i].value = charId;
|
||||
font.chars[i].rec = (Rectangle){ charX, charY, charWidth, charHeight };
|
||||
font.chars[i].rec = (Rectangle){ (float) charX, (float) charY, (float) charWidth, (float) charHeight };
|
||||
font.chars[i].offsetX = charOffsetX;
|
||||
font.chars[i].offsetY = charOffsetY;
|
||||
font.chars[i].advanceX = charAdvanceX;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue