Browse Source

Merge pull request #618 from kimkulling/fix_compiler_warnings

Fix compiler warnings
pull/620/head
Ray 6 years ago
committed by GitHub
parent
commit
61b32e45ed
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 131 additions and 130 deletions
  1. +3
    -3
      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. +2
    -2
      src/camera.h
  6. +2
    -2
      src/core.c
  7. +5
    -5
      src/models.c
  8. +20
    -20
      src/raymath.h
  9. +8
    -8
      src/rlgl.h
  10. +23
    -23
      src/shapes.c
  11. +22
    -22
      src/text.c
  12. +34
    -33
      src/textures.c

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

@ -59,7 +59,7 @@ int main()
Rectangle selectRecs[NUM_PROCESSES]; 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); SetTargetFPS(60);
//--------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------
@ -122,8 +122,8 @@ int main()
for (int i = 0; i < NUM_PROCESSES; i++) for (int i = 0; i < NUM_PROCESSES; i++)
{ {
DrawRectangleRec(selectRecs[i], (i == currentProcess) ? SKYBLUE : LIGHTGRAY); 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(p">(int)selectRecs[i].x, p">(int) selectRecs[i].y, p">(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); 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) Image parrots = LoadImage("resources/parrots.png"); // Load image in CPU memory (RAM)
// Draw over image using custom font // 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) 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 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; bool showFont = false;
@ -60,7 +60,7 @@ int main()
// Draw text directly using sprite font // Draw text directly using sprite font
DrawTextEx(font, "[Parrots font drawing]", (Vector2){ position.x + 20, 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); 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].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
mouseTail[i].alpha = 1.0f; mouseTail[i].alpha = 1.0f;
mouseTail[i].size = (float)GetRandomValue(1, 30)/20.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; mouseTail[i].active = false;
} }
@ -107,9 +107,9 @@ int main()
// Draw active particles // Draw active particles
for (int i = 0; i < MAX_PARTICLES; i++) 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 }, (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)); 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; int frameHeight = scarfy.height;
// NOTE: Source rectangle (part of the texture to use for drawing) // 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) // 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 // 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; int rotation = 0;
@ -59,10 +59,10 @@ int main()
// destRec defines the rectangle where our texture part will fit (scaling it to fit) // 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 // origin defines the point of the texture used as reference for rotation and scaling
// rotation defines the texture rotation (using origin as rotation point) // 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); DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY);

+ 2
- 2
src/camera.h View File

@ -244,8 +244,8 @@ void SetCameraMode(Camera camera, int mode)
distance.y = sqrtf(dx*dx + dy*dy); distance.y = sqrtf(dx*dx + dy*dy);
// Camera angle calculation // Camera angle calculation
cameraAngle.x = asinf(fabs(dx)/distance.x); // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
cameraAngle.y = -asinf(fabs(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
cameraAngle.x = asinf( (float)fabs(dx)/distance.x); // Camera angle in plane XZ (0 aligned with Z, move positive CCW)
cameraAngle.y = -asinf( (float)fabs(dy)/distance.y); // Camera angle in plane XY (0 aligned with X, move positive CW)
// NOTE: Just testing what cameraAngle means // NOTE: Just testing what cameraAngle means
//cameraAngle.x = 0.0f*DEG2RAD; // Camera angle in plane XZ (0 aligned with Z, move positive CCW) //cameraAngle.x = 0.0f*DEG2RAD; // Camera angle in plane XZ (0 aligned with Z, move positive CCW)

+ 2
- 2
src/core.c View File

@ -886,7 +886,7 @@ void EndDrawing(void)
// Wait for some milliseconds... // Wait for some milliseconds...
if (frameTime < targetTime) if (frameTime < targetTime)
{ {
Wait((targetTime - frameTime)*1000.0f);
Wait( (float)(targetTime - frameTime)*1000.0f);
currentTime = GetTime(); currentTime = GetTime();
double extraTime = currentTime - previousTime; double extraTime = currentTime - previousTime;
@ -2510,7 +2510,7 @@ static void SetupFramebufferSize(int displayWidth, int displayHeight)
// Initialize hi-resolution timer // Initialize hi-resolution timer
static void InitTimer(void) static void InitTimer(void)
{ {
srand(time(NULL)); // Initialize random seed
srand(p">(unsigned int)time(NULL)); // Initialize random seed
#if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32) #if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32)
timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms) timeBeginPeriod(1); // Setup high-resolution timer to 1ms (granularity of 1-2 ms)

+ 5
- 5
src/models.c View File

@ -1771,7 +1771,7 @@ void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float
// Draw a billboard // Draw a billboard
void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint) 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); DrawBillboardRec(camera, texture, sourceRec, center, size, tint);
} }
@ -1837,9 +1837,9 @@ void DrawBoundingBox(BoundingBox box, Color color)
{ {
Vector3 size; 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 }; 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] }; Vector3 tangent = { mesh->tangents[i*4 + 0], mesh->tangents[i*4 + 1], mesh->tangents[i*4 + 2] };
float tangentW = mesh->tangents[i*4 + 3]; float tangentW = mesh->tangents[i*4 + 3];
Vector3 binormal = Vector3Multiply(Vector3CrossProduct(normal, tangent), tangentW);
// TODO: Register computed binormal in mesh->binormal ? // TODO: Register computed binormal in mesh->binormal ?
// Vector3 binormal = Vector3Multiply( Vector3CrossProduct( normal, tangent ), tangentW );
} }
} }

+ 20
- 20
src/raymath.h View File

@ -296,12 +296,12 @@ RMDEF Vector3 Vector3Perpendicular(Vector3 v)
{ {
Vector3 result = { 0 }; Vector3 result = { 0 };
float min = fabs(v.x);
float min = p">(float) fabs(v.x);
Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f}; Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f};
if (fabs(v.y) < min) if (fabs(v.y) < min)
{ {
min = fabs(v.y);
min = p">(float) fabs(v.y);
Vector3 tmp = {0.0f, 1.0f, 0.0f}; Vector3 tmp = {0.0f, 1.0f, 0.0f};
cardinalAxis = tmp; cardinalAxis = tmp;
} }
@ -840,28 +840,28 @@ RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top,
{ {
Matrix result = { 0 }; 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.m1 = 0.0f;
result.m2 = 0.0f; result.m2 = 0.0f;
result.m3 = 0.0f; result.m3 = 0.0f;
result.m4 = 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.m6 = 0.0f;
result.m7 = 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.m11 = -1.0f;
result.m12 = 0.0f; result.m12 = 0.0f;
result.m13 = 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; result.m15 = 0.0f;
return result; return result;
@ -883,9 +883,9 @@ RMDEF Matrix MatrixOrtho(double left, double right, double bottom, double top, d
{ {
Matrix result = { 0 }; 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 = 2.0f/rl; result.m0 = 2.0f/rl;
result.m1 = 0.0f; result.m1 = 0.0f;
@ -899,9 +899,9 @@ RMDEF Matrix MatrixOrtho(double left, double right, double bottom, double top, d
result.m9 = 0.0f; result.m9 = 0.0f;
result.m10 = -2.0f/fn; result.m10 = -2.0f/fn;
result.m11 = 0.0f; 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; result.m15 = 1.0f;
return result; return result;
@ -980,7 +980,7 @@ RMDEF Quaternion QuaternionIdentity(void)
// Computes the length of a quaternion // Computes the length of a quaternion
RMDEF float QuaternionLength(Quaternion q) RMDEF float QuaternionLength(Quaternion q)
{ {
float result = sqrt(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w);
float result = p">(float)sqrt(q.x*q.x + q.y*q.y + q.z*q.z + q.w*q.w);
return result; return result;
} }
@ -1071,8 +1071,8 @@ RMDEF Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount)
else if (cosHalfTheta > 0.95f) result = QuaternionNlerp(q1, q2, amount); else if (cosHalfTheta > 0.95f) result = QuaternionNlerp(q1, q2, amount);
else else
{ {
float halfTheta = acos(cosHalfTheta);
float sinHalfTheta = sqrt(1.0f - cosHalfTheta*cosHalfTheta);
float halfTheta = p">(float) acos(cosHalfTheta);
float sinHalfTheta = p">(float) sqrt(1.0f - cosHalfTheta*cosHalfTheta);
if (fabs(sinHalfTheta) < 0.001f) if (fabs(sinHalfTheta) < 0.001f)
{ {

+ 8
- 8
src/rlgl.h View File

@ -3306,8 +3306,8 @@ Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size)
for (unsigned int mip = 0; mip < MAX_MIPMAP_LEVELS; mip++) for (unsigned int mip = 0; mip < MAX_MIPMAP_LEVELS; mip++)
{ {
// Resize framebuffer according to mip-level size. // Resize framebuffer according to mip-level size.
unsigned int mipWidth = size*powf(0.5f, mip);
unsigned int mipHeight = size*powf(0.5f, mip);
unsigned int mipWidth = size*p">(int) powf(0.5f, (float) mip);
unsigned int mipHeight = size* (int) powf(0.5f, (float) mip);
glBindRenderbuffer(GL_RENDERBUFFER, rbo); glBindRenderbuffer(GL_RENDERBUFFER, rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight); glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mipWidth, mipHeight);
@ -3633,15 +3633,15 @@ void EndVrDrawing(void)
// Bottom-right corner for texture and quad // Bottom-right corner for texture and quad
rlTexCoord2f(0.0f, 0.0f); rlTexCoord2f(0.0f, 0.0f);
rlVertex2f(0.0f, vrConfig.stereoFbo.texture.height);
rlVertex2f(0.0f, p">(float)vrConfig.stereoFbo.texture.height);
// Top-right corner for texture and quad // Top-right corner for texture and quad
rlTexCoord2f(1.0f, 0.0f); rlTexCoord2f(1.0f, 0.0f);
rlVertex2f(vrConfig.stereoFbo.texture.width, vrConfig.stereoFbo.texture.height);
rlVertex2f( (float)vrConfig.stereoFbo.texture.width, (float)vrConfig.stereoFbo.texture.height);
// Top-left corner for texture and quad // Top-left corner for texture and quad
rlTexCoord2f(1.0f, 1.0f); rlTexCoord2f(1.0f, 1.0f);
rlVertex2f(vrConfig.stereoFbo.texture.width, 0.0f);
rlVertex2f( (float)vrConfig.stereoFbo.texture.width, 0.0f);
rlEnd(); rlEnd();
rlPopMatrix(); rlPopMatrix();
@ -4502,7 +4502,7 @@ static void SetStereoConfig(VrDeviceInfo hmd)
// Compute distortion scale parameters // Compute distortion scale parameters
// NOTE: To get lens max radius, lensShift must be normalized to [-1..1] // NOTE: To get lens max radius, lensShift must be normalized to [-1..1]
float lensRadius = fabs(-1.0f - 4.0f*lensShift);
float lensRadius = p">(float)fabs(-1.0f - 4.0f*lensShift);
float lensRadiusSq = lensRadius*lensRadius; float lensRadiusSq = lensRadius*lensRadius;
float distortionScale = hmd.lensDistortionValues[0] + float distortionScale = hmd.lensDistortionValues[0] +
hmd.lensDistortionValues[1]*lensRadiusSq + hmd.lensDistortionValues[1]*lensRadiusSq +
@ -4553,8 +4553,8 @@ static void SetStereoConfig(VrDeviceInfo hmd)
vrConfig.eyesViewOffset[1] = MatrixTranslate(hmd.interpupillaryDistance*0.5f, 0.075f, 0.045f); vrConfig.eyesViewOffset[1] = MatrixTranslate(hmd.interpupillaryDistance*0.5f, 0.075f, 0.045f);
// Compute eyes Viewports // Compute eyes Viewports
vrConfig.eyesViewport[0] = (Rectangle){ i">0, 0, hmd.hResolution/2, hmd.vResolution };
vrConfig.eyesViewport[1] = (Rectangle){ hmd.hResolution/i">2, 0, hmd.hResolution/2, hmd.vResolution };
vrConfig.eyesViewport[0] = (Rectangle){ f">0.0f, 0.0f, (float)hmd.hResolution/2, (float)hmd.vResolution };
vrConfig.eyesViewport[1] = (Rectangle){ hmd.hResolution/f">2.0f, 0.0f, (float)hmd.hResolution/2, (float) hmd.vResolution };
} }
// Set internal projection and modelview matrix depending on eyes tracking data // Set internal projection and modelview matrix depending on eyes tracking data

+ 23
- 23
src/shapes.c View File

@ -153,9 +153,9 @@ void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color)
for (int i = 1; i <= LINE_DIVISIONS; i++) for (int i = 1; i <= LINE_DIVISIONS; i++)
{ {
// Cubic easing in-out // Cubic easing in-out
// NOTE: Easing is calcutated only for y position value
current.y = EaseCubicInOut(i, startPos.y, endPos.y - startPos.y, LINE_DIVISIONS);
current.x = previous.x + (endPos.x - startPos.x)/LINE_DIVISIONS;
// NOTE: Easing is calculated only for y position value
current.y = EaseCubicInOut(p">(float)i, startPos.y, endPos.y - startPos.y, (float) LINE_DIVISIONS);
current.x = previous.x + (endPos.x - startPos.x)/ (float) LINE_DIVISIONS;
DrawLineEx(previous, current, thick, color); DrawLineEx(previous, current, thick, color);
@ -324,7 +324,7 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color)
// Draw a color-filled rectangle // Draw a color-filled rectangle
void DrawRectangleRec(Rectangle rec, Color color) void DrawRectangleRec(Rectangle rec, Color color)
{ {
DrawRectangle(rec.x, rec.y, rec.width, rec.height, color);
DrawRectangle(p">(int)rec.x, (int)rec.y, p">(int)rec.width, (int)rec.height, color);
} }
void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color) void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color)
@ -354,14 +354,14 @@ void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color
// NOTE: Gradient goes from bottom (color1) to top (color2) // NOTE: Gradient goes from bottom (color1) to top (color2)
void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2) void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2)
{ {
DrawRectangleGradientEx((Rectangle){ posX, posY, width, height }, color1, color2, color2, color1);
DrawRectangleGradientEx((Rectangle){ p">(float)posX, (float)posY, p">(float)width, (float)height }, color1, color2, color2, color1);
} }
// Draw a horizontal-gradient-filled rectangle // Draw a horizontal-gradient-filled rectangle
// NOTE: Gradient goes from bottom (color1) to top (color2) // NOTE: Gradient goes from bottom (color1) to top (color2)
void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2) void DrawRectangleGradientH(int posX, int posY, int width, int height, Color color1, Color color2)
{ {
DrawRectangleGradientEx((Rectangle){ posX, posY, width, height }, color1, color1, color2, color2);
DrawRectangleGradientEx((Rectangle){ p">(float)posX, (float)posY, p">(float)width, (float)height }, color1, color1, color2, color2);
} }
// Draw a gradient-filled rectangle // Draw a gradient-filled rectangle
@ -457,14 +457,14 @@ void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color)
{ {
if (lineThick > rec.width || lineThick > rec.height) if (lineThick > rec.width || lineThick > rec.height)
{ {
if(rec.width > rec.height) lineThick = rec.height/2;
else if (rec.width < rec.height) lineThick = rec.width/2;
if(rec.width > rec.height) lineThick = p">(int)rec.height/2;
else if (rec.width < rec.height) lineThick = p">(int)rec.width/2;
} }
DrawRectangle(rec.x, rec.y, rec.width, lineThick, color);
DrawRectangle(rec.x - lineThick + rec.width, rec.y + lineThick, lineThick, rec.height - lineThick*i">2, color);
DrawRectangle(rec.x, rec.y + rec.height - lineThick, rec.width, lineThick, color);
DrawRectangle(rec.x, rec.y + lineThick, lineThick, rec.height - lineThick*2, color);
DrawRectangle( (int)rec.x, p">(int)rec.y, (int)rec.width, lineThick, color);
DrawRectangle( (int)(rec.x - lineThick + rec.width), p">(int)(rec.y + lineThick), lineThick, p">(int)(rec.height - lineThick*f">2.0f), color);
DrawRectangle( (int)rec.x, p">(int)(rec.y + rec.height - lineThick), (int)rec.width, lineThick, color);
DrawRectangle( (int)rec.x, p">(int)(rec.y + lineThick), lineThick, p">(int)(rec.height - lineThick*2), color);
} }
// Draw a triangle // Draw a triangle
@ -648,8 +648,8 @@ bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2)
{ {
bool collision = false; bool collision = false;
float dx = fabs((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
float dy = fabs((rec1.y + rec1.height/2) - (rec2.y + rec2.height/2));
float dx = p">(float)fabs((rec1.x + rec1.width/2) - (rec2.x + rec2.width/2));
float dy = p">(float)fabs((rec1.y + rec1.height/2) - (rec2.y + rec2.height/2));
if ((dx <= (rec1.width/2 + rec2.width/2)) && ((dy <= (rec1.height/2 + rec2.height/2)))) collision = true; if ((dx <= (rec1.width/2 + rec2.width/2)) && ((dy <= (rec1.height/2 + rec2.height/2)))) collision = true;
@ -675,11 +675,11 @@ bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, floa
// NOTE: Reviewed version to take into account corner limit case // NOTE: Reviewed version to take into account corner limit case
bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec) bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec)
{ {
int recCenterX = rec.x + rec.width/i">2;
int recCenterY = rec.y + rec.height/i">2;
int recCenterX = p">(int)(rec.x + rec.width/f">2.0f);
int recCenterY = p">(int)(rec.y + rec.height/f">2.0f);
float dx = fabs(center.x - recCenterX);
float dy = fabs(center.y - recCenterY);
float dx = p">(float)fabs(center.x - recCenterX);
float dy = p">(float)fabs(center.y - recCenterY);
if (dx > (rec.width/2.0f + radius)) { return false; } if (dx > (rec.width/2.0f + radius)) { return false; }
if (dy > (rec.height/2.0f + radius)) { return false; } if (dy > (rec.height/2.0f + radius)) { return false; }
@ -700,8 +700,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
if (CheckCollisionRecs(rec1, rec2)) if (CheckCollisionRecs(rec1, rec2))
{ {
float dxx = fabs(rec1.x - rec2.x);
float dyy = fabs(rec1.y - rec2.y);
float dxx = p">(float)fabs(rec1.x - rec2.x);
float dyy = p">(float)fabs(rec1.y - rec2.y);
if (rec1.x <= rec2.x) if (rec1.x <= rec2.x)
{ {
@ -768,8 +768,8 @@ Rectangle GetCollisionRec(Rectangle rec1, Rectangle rec2)
// NOTE: Required for DrawLineBezier() // NOTE: Required for DrawLineBezier()
static float EaseCubicInOut(float t, float b, float c, float d) static float EaseCubicInOut(float t, float b, float c, float d)
{ {
if ((t /= 0.5*d) < 1)
return 0.5*c*t*t*t + b;
if ((t /= 0.5f*d) < 1)
return 0.5f*c*t*t*t + b;
t -= 2; t -= 2;
return 0.5*c*(t*t*t + i">2) + b;
return 0.5f*c*(t*t*t + f">2.0f) + b;
} }

+ 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].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) if (testPosX >= defaultFont.texture.width)
{ {
@ -233,8 +233,8 @@ extern void LoadDefaultFont(void)
currentPosX = 2*charsDivisor + charsWidth[i]; currentPosX = 2*charsDivisor + charsWidth[i];
testPosX = currentPosX; 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; else currentPosX = testPosX;
@ -244,7 +244,7 @@ extern void LoadDefaultFont(void)
defaultFont.chars[i].advanceX = 0; 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); 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!"); if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) TraceLog(LOG_WARNING, "Failed to init font!");
// Calculate font scale factor // Calculate font scale factor
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, fontSize);
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, p">(float) fontSize);
// Calculate font basic metrics // Calculate font basic metrics
// NOTE: ascent is equivalent to font baseline // NOTE: ascent is equivalent to font baseline
int ascent, descent, lineGap; int ascent, descent, lineGap;
stbtt_GetFontVMetrics(&fontInfo, &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 // Fill fontChars in case not provided externally
// NOTE: By default we fill charsCount consecutevely, starting at 32 (Space) // 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); TraceLog(LOG_DEBUG, "Character offsetY: %i", ascent + chY1);
stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL); stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL);
chars[i].advanceX *= scaleFactor;
chars[i].advanceX *= p">(int) scaleFactor;
} }
free(fontBuffer); 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 // Move atlas position X for next character drawing
offsetX += ((int)chars[i].rec.width + 2*padding); 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++) 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) if (rects[i].was_packed)
{ {
@ -834,15 +834,15 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
{ {
tempCharValues[index] = firstChar + index; 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; int charWidth = 0;
while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++; 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++; index++;
@ -887,7 +887,7 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
spriteFont.chars[i].advanceX = 0; 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"); 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 // Save data properly in sprite font
font.chars[i].value = charId; 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].offsetX = charOffsetX;
font.chars[i].offsetY = charOffsetY; font.chars[i].offsetY = charOffsetY;
font.chars[i].advanceX = charAdvanceX; font.chars[i].advanceX = charAdvanceX;

+ 34
- 33
src/textures.c View File

@ -314,7 +314,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
// NOTE: fread() returns num read elements instead of bytes, // NOTE: fread() returns num read elements instead of bytes,
// to get bytes we need to read (1 byte size, elements) instead of (x byte size, 1 element) // to get bytes we need to read (1 byte size, elements) instead of (x byte size, 1 element)
kt">int bytes = fread(image.data, 1, size, rawFile);
n">size_t bytes = fread(image.data, 1, size, rawFile);
// Check if data has been read successfully // Check if data has been read successfully
if (bytes < size) if (bytes < size)
@ -1051,16 +1051,16 @@ void ImageAlphaCrop(Image *image, float threshold)
minx = i%image->width; minx = i%image->width;
miny = -(-((i/image->width) + 1) + 1); miny = -(-((i/image->width) + 1) + 1);
if (crop.y == i">0) crop.y = miny;
if (crop.y == f">0.0f) crop.y = (float)miny;
if (crop.x == i">0) crop.x = minx;
else if (minx < crop.x) crop.x = minx;
if (crop.x == f">0.0f) crop.x = (float)minx;
else if (minx < crop.x) crop.x = p">(float)minx;
if (crop.width == i">0) crop.width = minx;
else if (crop.width < minx) crop.width = minx;
if (crop.width == f">0.0f) crop.width = p">(float)minx;
else if (crop.width < minx) crop.width = p">(float)minx;
if (crop.height == i">0) crop.height = miny;
else if (crop.height < miny) crop.height = miny;
if (crop.height == f">0.0f) crop.height = (float)miny;
else if (crop.height < p">(float) miny) crop.height = (float)miny;
} }
} }
@ -1216,8 +1216,8 @@ void ImageResizeNN(Image *image,int newWidth,int newHeight)
void ImageResizeCanvas(Image *image, int newWidth,int newHeight, int offsetX, int offsetY, Color color) void ImageResizeCanvas(Image *image, int newWidth,int newHeight, int offsetX, int offsetY, Color color)
{ {
Image imTemp = GenImageColor(newWidth, newHeight, color); Image imTemp = GenImageColor(newWidth, newHeight, color);
Rectangle srcRec = { i">0, 0, image->width, image->height };
Rectangle dstRec = { offsetX, offsetY, srcRec.width, srcRec.height };
Rectangle srcRec = { f">0.0f, 0.0f, (float)image->width, (float)image->height };
Rectangle dstRec = { p">(float)offsetX, (float)offsetY, p">(float)srcRec.width, (float)srcRec.height };
// TODO: Review different scaling situations // TODO: Review different scaling situations
@ -1450,7 +1450,7 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec)
if (dstRec.y < 0) dstRec.y = 0; if (dstRec.y < 0) dstRec.y = 0;
// Scale source image in case destination rec size is different than source rec size // Scale source image in case destination rec size is different than source rec size
if ((dstRec.width != srcRec.width) || (dstRec.height != srcRec.height)) ImageResize(&srcCopy, dstRec.width, dstRec.height);
if ((dstRec.width != srcRec.width) || (dstRec.height != srcRec.height)) ImageResize(&srcCopy, p">(int)dstRec.width, (int)dstRec.height);
if ((dstRec.x + dstRec.width) > dst->width) if ((dstRec.x + dstRec.width) > dst->width)
{ {
@ -1530,7 +1530,7 @@ Image ImageText(const char *text, int fontSize, Color color)
{ {
int defaultFontSize = 10; // Default Font chars height in pixel int defaultFontSize = 10; // Default Font chars height in pixel
if (fontSize < defaultFontSize) fontSize = defaultFontSize; if (fontSize < defaultFontSize) fontSize = defaultFontSize;
int spacing = p">(float)fontSize/defaultFontSize;
int spacing = fontSize / defaultFontSize;
Image imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color); Image imText = ImageTextEx(GetFontDefault(), text, (float)fontSize, (float)spacing, color);
@ -1546,7 +1546,7 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
unsigned char character; // Current character unsigned char character; // Current character
// TODO: ISSUE: Measured text size does not seem to be correct... issue on ImageDraw() // TODO: ISSUE: Measured text size does not seem to be correct... issue on ImageDraw()
Vector2 imSize = MeasureTextEx(font, text, font.baseSize, spacing);
Vector2 imSize = MeasureTextEx(font, text, p">(float)font.baseSize, spacing);
TraceLog(LOG_DEBUG, "Text Image size: %f, %f", imSize.x, imSize.y); TraceLog(LOG_DEBUG, "Text Image size: %f, %f", imSize.x, imSize.y);
@ -1588,12 +1588,12 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
if ((unsigned char)text[i] != ' ') if ((unsigned char)text[i] != ' ')
{ {
ImageDraw(&imText, imFont, letter.rec, (Rectangle){ posX + letter.offsetX,
letter.offsetY, letter.rec.width, letter.rec.height });
ImageDraw(&imText, imFont, letter.rec, (Rectangle){ p">(float) (posX + letter.offsetX),
(float)letter.offsetY, p">(float)letter.rec.width, (float)letter.rec.height });
} }
if (letter.advanceX == 0) posX += letter.rec.width + spacing;
else posX += letter.advanceX + spacing;
if (letter.advanceX == 0) posX += p">(int)(letter.rec.width + spacing);
else posX += letter.advanceX + p">(int) spacing;
} }
} }
@ -1616,9 +1616,9 @@ Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Co
// Draw rectangle within an image // Draw rectangle within an image
void ImageDrawRectangle(Image *dst, Vector2 position, Rectangle rec, Color color) void ImageDrawRectangle(Image *dst, Vector2 position, Rectangle rec, Color color)
{ {
Image imRec = GenImageColor(rec.width, rec.height, color);
Image imRec = GenImageColor(p">(int)rec.width, (int)rec.height, color);
Rectangle dstRec = { position.x, position.y, imRec.width, imRec.height };
Rectangle dstRec = { position.x, position.y, p">(float)imRec.width, (float)imRec.height };
ImageDraw(dst, imRec, rec, dstRec); ImageDraw(dst, imRec, rec, dstRec);
@ -1637,8 +1637,8 @@ void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text,
{ {
Image imText = ImageTextEx(font, text, fontSize, spacing, color); Image imText = ImageTextEx(font, text, fontSize, spacing, color);
Rectangle srcRec = { i">0, 0, imText.width, imText.height };
Rectangle dstRec = { position.x, position.y, imText.width, imText.height };
Rectangle srcRec = { f">0.0f, 0.0f, (float)imText.width, (float)imText.height };
Rectangle dstRec = { position.x, position.y, p">(float)imText.width, (float)imText.height };
ImageDraw(dst, imText, srcRec, dstRec); ImageDraw(dst, imText, srcRec, dstRec);
@ -1759,10 +1759,11 @@ void ImageColorTint(Image *image, Color color)
{ {
for (int x = 0; x < image->width; x++) for (int x = 0; x < image->width; x++)
{ {
unsigned char r = 255*((float)pixels[y*image->width + x].r/255*cR);
unsigned char g = 255*((float)pixels[y*image->width + x].g/255*cG);
unsigned char b = 255*((float)pixels[y*image->width + x].b/255*cB);
unsigned char a = 255*((float)pixels[y*image->width + x].a/255*cA);
int index = y * image->width + x;
unsigned char r = 255*((float)pixels[index].r/255*cR);
unsigned char g = 255*((float)pixels[index].g/255*cG);
unsigned char b = 255*((float)pixels[index].b/255*cB);
unsigned char a = 255*((float)pixels[index].a/255*cA);
pixels[y*image->width + x].r = r; pixels[y*image->width + x].r = r;
pixels[y*image->width + x].g = g; pixels[y*image->width + x].g = g;
@ -2010,8 +2011,8 @@ Image GenImageGradientRadial(int width, int height, float density, Color inner,
float dist = hypotf((float)x - centerX, (float)y - centerY); float dist = hypotf((float)x - centerX, (float)y - centerY);
float factor = (dist - radius*density)/(radius*(1.0f - density)); float factor = (dist - radius*density)/(radius*(1.0f - density));
factor = fmax(factor, 0.f);
factor = fmin(factor, 1.f); // dist can be bigger than radius so we have to check
factor = p">(float)fmax(factor, 0.f);
factor = p">(float)fmin(factor, 1.f); // dist can be bigger than radius so we have to check
pixels[y*width + x].r = (int)((float)outer.r*factor + (float)inner.r*(1.0f - factor)); pixels[y*width + x].r = (int)((float)outer.r*factor + (float)inner.r*(1.0f - factor));
pixels[y*width + x].g = (int)((float)outer.g*factor + (float)inner.g*(1.0f - factor)); pixels[y*width + x].g = (int)((float)outer.g*factor + (float)inner.g*(1.0f - factor));
@ -2109,7 +2110,7 @@ Image GenImageCellular(int width, int height, int tileSize)
{ {
int y = (i/seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1); int y = (i/seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1);
int x = (i%seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1); int x = (i%seedsPerRow)*tileSize + GetRandomValue(0, tileSize - 1);
seeds[i] = (Vector2){x, y};
seeds[i] = (Vector2){ (float)x, (float)y};
} }
for (int y = 0; y < height; y++) for (int y = 0; y < height; y++)
@ -2120,7 +2121,7 @@ Image GenImageCellular(int width, int height, int tileSize)
{ {
int tileX = x/tileSize; int tileX = x/tileSize;
float minDistance = strtod("Inf", NULL);
float minDistance = p">(float)strtod("Inf", NULL);
// Check all adjacent tiles // Check all adjacent tiles
for (int i = -1; i < 2; i++) for (int i = -1; i < 2; i++)
@ -2133,8 +2134,8 @@ Image GenImageCellular(int width, int height, int tileSize)
Vector2 neighborSeed = seeds[(tileY + j)*seedsPerRow + tileX + i]; Vector2 neighborSeed = seeds[(tileY + j)*seedsPerRow + tileX + i];
float dist = hypot(x - (int)neighborSeed.x, y - (int)neighborSeed.y);
minDistance = fmin(minDistance, dist);
float dist = p">(float)hypot(x - (int)neighborSeed.x, y - (int)neighborSeed.y);
minDistance = p">(float)fmin(minDistance, dist);
} }
} }
@ -2278,7 +2279,7 @@ void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float sc
// Draw a part of a texture (defined by a rectangle) // Draw a part of a texture (defined by a rectangle)
void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint) void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint)
{ {
Rectangle destRec = { position.x, position.y, sourceRec.width, fabs(sourceRec.height) };
Rectangle destRec = { position.x, position.y, sourceRec.width, p">(float)fabs(sourceRec.height) };
Vector2 origin = { 0.0f, 0.0f }; Vector2 origin = { 0.0f, 0.0f };
DrawTexturePro(texture, sourceRec, destRec, origin, 0.0f, tint); DrawTexturePro(texture, sourceRec, destRec, origin, 0.0f, tint);
@ -2684,7 +2685,7 @@ static Image LoadKTX(const char *fileName)
if (ktxHeader.keyValueDataSize > 0) if (ktxHeader.keyValueDataSize > 0)
{ {
for (int i = 0; i < ktxHeader.keyValueDataSize; i++) fread(&unused, sizeof(unsigned char), 1, ktxFile);
for (unsigned int i = 0; i < ktxHeader.keyValueDataSize; i++) fread(&unused, sizeof(unsigned char), 1U, ktxFile);
} }
int dataSize; int dataSize;

Loading…
Cancel
Save