Skip to content

Commit

Permalink
Fix MSVC warnings.
Browse files Browse the repository at this point in the history
Make raymath.h work in C++ in MSVC
  • Loading branch information
JeffM2501 committed Jul 1, 2024
1 parent 95d0826 commit 8ee7381
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/raymath.h
Original file line number Diff line number Diff line change
Expand Up @@ -2549,9 +2549,13 @@ RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotatio

// Extract scale
const float det = a*A + b*B + c*C;
float scalex = Vector3Length((Vector3){ a, b, c });
float scaley = Vector3Length((Vector3){ d, e, f });
float scalez = Vector3Length((Vector3){ g, h, i });
Vector3 abc = { a, b, c };
Vector3 def = { d, e, f };
Vector3 ghi = { g, h, i };

float scalex = Vector3Length(abc);
float scaley = Vector3Length(def);
float scalez = Vector3Length(ghi);
Vector3 s = { scalex, scaley, scalez };

if (det < 0) s = Vector3Negate(s);
Expand Down
4 changes: 2 additions & 2 deletions src/rtextures.c
Original file line number Diff line number Diff line change
Expand Up @@ -3658,7 +3658,7 @@ void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color co
{
// Line is more horizontal
// Calculate half the width of the line
int wy = (thick - 1)*sqrtf(dx*dx + dy*dy)/(2*abs(dx));
int wy = (thick - 1)*(int)sqrtf((float)(dx*dx + dy*dy))/(2*abs(dx));

// Draw additional lines above and below the main line
for (int i = 1; i <= wy; i++)
Expand All @@ -3671,7 +3671,7 @@ void ImageDrawLineEx(Image *dst, Vector2 start, Vector2 end, int thick, Color co
{
// Line is more vertical or perfectly horizontal
// Calculate half the width of the line
int wx = (thick - 1)*sqrtf(dx*dx + dy*dy)/(2*abs(dy));
int wx = (thick - 1)*(int)sqrtf((float)(dx*dx + dy*dy))/(2*abs(dy));

// Draw additional lines to the left and right of the main line
for (int i = 1; i <= wx; i++)
Expand Down

0 comments on commit 8ee7381

Please sign in to comment.