From ca0ba5505079f975b6e079084ded066b954124c4 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 7 Jun 2026 21:26:32 +0200 Subject: [PATCH] Reviewed parameter names, added comment about order --- src/raylib.h | 2 +- src/rshapes.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index 857df2217..28b683cef 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1291,7 +1291,7 @@ RLAPI void DrawRectangleRec(Rectangle rec, Color color); RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color); // Draw a color-filled rectangle with pro parameters RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color top, Color bottom); // Draw a vertical-gradient-filled rectangle RLAPI void DrawRectangleGradientH(int posX, int posY, int width, int height, Color left, Color right); // Draw a horizontal-gradient-filled rectangle -RLAPI void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color bottomRight, Color topRight); // Draw a gradient-filled rectangle with custom vertex colors, counter-clockwise color order +RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // Draw a gradient-filled rectangle with custom vertex colors, counter-clockwise color order RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color); // Draw rectangle outline RLAPI void DrawRectangleLinesEx(Rectangle rec, float thick, Color color); // Draw rectangle outline with line thickness RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges diff --git a/src/rshapes.c b/src/rshapes.c index 51bc15a60..12ae6a164 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -547,8 +547,8 @@ void DrawRectangleGradientH(int posX, int posY, int width, int height, Color lef DrawRectangleGradientEx((Rectangle){ (float)posX, (float)posY, (float)width, (float)height }, left, left, right, right); } -// Draw a gradient-filled rectangle -void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Color bottomRight, Color topRight) +// Draw a gradient-filled rectangle with custom vertex colors, counter-clockwise color order +void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4) { rlSetTexture(GetShapesTexture().id); Rectangle shapeRect = GetShapesTextureRectangle(); @@ -557,19 +557,19 @@ void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Col rlNormal3f(0.0f, 0.0f, 1.0f); // NOTE: Default raylib font character 95 is a white square - rlColor4ub(topLeft.r, topLeft.g, topLeft.b, topLeft.a); + rlColor4ub(col1.r, col1.g, col1.b, col1.a); rlTexCoord2f(shapeRect.x/texShapes.width, shapeRect.y/texShapes.height); rlVertex2f(rec.x, rec.y); - rlColor4ub(bottomLeft.r, bottomLeft.g, bottomLeft.b, bottomLeft.a); + rlColor4ub(col2.r, col2.g, col2.b, col2.a); rlTexCoord2f(shapeRect.x/texShapes.width, (shapeRect.y + shapeRect.height)/texShapes.height); rlVertex2f(rec.x, rec.y + rec.height); - rlColor4ub(bottomRight.r, bottomRight.g, bottomRight.b, bottomRight.a); + rlColor4ub(col3.r, col3.g, col3.b, col3.a); rlTexCoord2f((shapeRect.x + shapeRect.width)/texShapes.width, (shapeRect.y + shapeRect.height)/texShapes.height); rlVertex2f(rec.x + rec.width, rec.y + rec.height); - rlColor4ub(topRight.r, topRight.g, topRight.b, topRight.a); + rlColor4ub(col4.r, col4.g, col4.b, col4.a); rlTexCoord2f((shapeRect.x + shapeRect.width)/texShapes.width, shapeRect.y/texShapes.height); rlVertex2f(rec.x + rec.width, rec.y); rlEnd();