Browse Source

Fix compiler warnings, first part

pull/618/head
Kim Kulling 6 years ago
parent
commit
ecf8bff4aa
7 changed files with 55 additions and 55 deletions
  1. +2
    -2
      examples/textures/textures_image_processing.c
  2. +3
    -3
      examples/textures/textures_image_text.c
  3. +3
    -3
      examples/textures/textures_particles_blending.c
  4. +6
    -6
      examples/textures/textures_srcrec_dstrec.c
  5. +5
    -5
      src/models.c
  6. +14
    -14
      src/raymath.h
  7. +22
    -22
      src/text.c

+ 2
- 2
examples/textures/textures_image_processing.c View File

@ -59,7 +59,7 @@ int main()
Rectangle selectRecs[NUM_PROCESSES];
for (int i = 0; i < NUM_PROCESSES; i++) selectRecs[i] = (Rectangle){ i">40, 50 + 32*i, 150, 30 };
for (int i = 0; i < NUM_PROCESSES; i++) selectRecs[i] = (Rectangle){ f">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, i">10, (i == currentProcess) ? DARKBLUE : DARKGRAY);
DrawText(processText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(processText[i], 10)/2, selectRecs[i].y + 11, f">10.0f, (i == currentProcess) ? DARKBLUE : DARKGRAY);
}
DrawTexture(texture, screenWidth - texture.width - 60, screenHeight/2 - texture.height/2, WHITE);

+ 3
- 3
examples/textures/textures_image_text.c 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){ i">20, 20 }, font, "[Parrots font drawing]", font.baseSize, i">0, WHITE);
ImageDrawTextEx(&parrots, (Vector2){ f">20.0f, 20.0f }, font, "[Parrots font drawing]", p">(float)font.baseSize, f">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 = { p">(float)(screenWidth/2 - texture.width/2), p">(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, i">0, WHITE);
position.y + 20 + 280 }, p">(float)font.baseSize, f">0.0f, WHITE);
}
else DrawTexture(font.texture, screenWidth/2 - font.texture.width/2, 50, BLACK);

+ 3
- 3
examples/textures/textures_particles_blending.c 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 = p">(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){ i">0, 0, smoke.width, smoke.height },
if (mouseTail[i].active) DrawTexturePro(smoke, (Rectangle){ f">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/i">2, smoke.height*mouseTail[i].size/i">2 }, mouseTail[i].rotation,
(Vector2){ p">(float) (smoke.width*mouseTail[i].size/f">2.0f), (float)(smoke.height*mouseTail[i].size/f">2.0f) }, mouseTail[i].rotation,
Fade(mouseTail[i].color, mouseTail[i].alpha));
}

+ 6
- 6
examples/textures/textures_srcrec_dstrec.c 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 = { i">0, 0, frameWidth, frameHeight };
Rectangle sourceRec = { f">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 = { p">(float) screenWidth/2, (float)screenHeight/2, p">(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 = { p">(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, p">(float)rotation, WHITE);
DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY);
DrawLine(0, destRec.y, screenWidth, destRec.y, GRAY);
DrawLine(p">(int) destRec.x, 0, (int) destRec.x, screenHeight, GRAY);
DrawLine(0, p">(int)destRec.y, screenWidth, (int)destRec.y, GRAY);
DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY);

+ 5
- 5
src/models.c View File

@ -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 = { i">0, 0, texture.width, texture.height };
Rectangle sourceRec = { f">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 = p">(float)fabs(box.max.x - box.min.x);
size.y = p">(float)fabs(box.max.y - box.min.y);
size.z = p">(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 );
}
}

+ 14
- 14
src/raymath.h View File

@ -296,12 +296,12 @@ RMDEF Vector3 Vector3Perpendicular(Vector3 v)
{
Vector3 result = { 0 };
float min = fabs(v.x);
float min = p">(float) fabs(v.x);
Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f};
if (fabs(v.y) < min)
{
min = fabs(v.y);
min = p">(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 = (kt">float)(right - left);
float tb = (kt">float)(top - bottom);
float fn = (kt">float)(far - near);
result.m0 = (near*2.0f)/rl;
result.m0 = (p">(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 = (p">(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 = (p">(float)right + (float)left)/rl;
result.m9 = (p">(float)top + (float)bottom)/tb;
result.m10 = -(p">(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 = -(p">(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 = -(p">(float)left + (float)right)/rl;
result.m13 = -(p">(float)top + (float)bottom)/tb;
result.m14 = -(p">(float)far + (float)near)/fn;
result.m15 = 1.0f;
return result;

+ 22
- 22
src/text.c View File

@ -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 = p">(float) currentPosX;
defaultFont.chars[i].rec.y = p">(float) charsDivisor + currentLine*(charsHeight + charsDivisor);
defaultFont.chars[i].rec.width = p">(float) charsWidth[i];
defaultFont.chars[i].rec.height = p">(float) charsHeight;
testPosX += (defaultFont.chars[i].rec.width + charsDivisor);
testPosX += (kt">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 = p">(float)charsDivisor;
defaultFont.chars[i].rec.y = p">(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 = p">(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, p">(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 *= p">(int) scaleFactor;
descent *= p">(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 *= p">(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 = p">(float) offsetX;
chars[i].rec.y = p">(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 + p">(float) padding;
chars[i].rec.y = rects[i].y + p">(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 = p">(float) xPosToRead;
tempCharRecs[index].y = p">(float) (lineSpacing + lineToRead*(charHeight + lineSpacing));
tempCharRecs[index].height = p">(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 = p">(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 = p">(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){ p">(float) charX, (float) charY, p">(float) charWidth, (float) charHeight };
font.chars[i].offsetX = charOffsetX;
font.chars[i].offsetY = charOffsetY;
font.chars[i].advanceX = charAdvanceX;

||||||
x
 
000:0
Loading…
Cancel
Save