2 Commits

Author SHA1 Message Date
c15f3214d5 [rshapes] Correct DrawPolyLinesEx() line thickness. (#6014)
Follow up to #6004. The previous formula would produce inconsistent results for different polygons with the same `thick` parameter.
2026-07-24 21:38:50 +02:00
Ray
a408dd332e REVIEWED: IsPathAbsolute(), remove isalpha() dependency 2026-07-24 21:17:11 +02:00
2 changed files with 7 additions and 6 deletions

View File

@ -2859,13 +2859,13 @@ bool IsPathAbsolute(const char *path)
if ((path != NULL) && (path[0] != '\0')) if ((path != NULL) && (path[0] != '\0'))
{ {
#if defined(_WIN32) #if defined(_WIN32)
// UNC path (\\server\share) // Check UNC path (\\server\share)
if ((path[0] == '\\') && (path[1] == '\\')) result = true; if ((path[0] == '\\') && (path[1] == '\\')) result = true;
// Drive letter (e.g. C:\ or D:/) // Check path starts with a drive letter (e.g. C:\ or D:/)
else if (isalpha((unsigned char)path[0]) && (path[1] == ':') && else if ((((path[0] >= 'A') && (path[0] <= 'Z')) || ((path[0] >= 'a') && (path[0] <= 'z'))) &&
((path[2] == '\\') || (path[2] == '/'))) result = true; (path[1] != '\0') && (path[1] == ':') && (path[2] != '\0') && ((path[2] == '\\') || (path[2] == '/'))) result = true;
#else #else
// POSIX: must start with / // Check POSIX path, must start with /
if (path[0] == '/') result = true; if (path[0] == '/') result = true;
#endif #endif
} }

View File

@ -1265,7 +1265,8 @@ void DrawPolyLinesEx(Vector2 center, int sides, float radius, float rotation, fl
if (sides < 3) sides = 3; if (sides < 3) sides = 3;
float centralAngle = rotation*DEG2RAD; float centralAngle = rotation*DEG2RAD;
float exteriorAngle = 360.0f/(float)sides*DEG2RAD; float exteriorAngle = 360.0f/(float)sides*DEG2RAD;
float innerRadius = fmaxf(0.0f, radius - (thick*cosf(DEG2RAD*exteriorAngle/2.0f))); float apothem = radius*cosf(DEG2RAD*180.0f/(float)sides);
float innerRadius = fmaxf(0.0f, radius - thick*(radius/apothem));
#if SUPPORT_QUADS_DRAW_MODE #if SUPPORT_QUADS_DRAW_MODE
rlSetTexture(GetShapesTexture().id); rlSetTexture(GetShapesTexture().id);