From ce3e35d9699c8fac8a0956fd5cd9181ccdc644b6 Mon Sep 17 00:00:00 2001 From: RadsammyT Date: Fri, 16 Aug 2024 18:35:14 -0400 Subject: [PATCH] ... and replace it with a -/+ 0.5 offset divided by current cam's zoom. --- src/rshapes.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/rshapes.c b/src/rshapes.c index 2ca270d16..43f520388 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -811,19 +811,21 @@ void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, // but it solves another issue: https://github.com/raysan5/raylib/issues/3884 void DrawRectangleLines(int posX, int posY, int width, int height, Color color) { + Matrix mat = rlGetMatrixModelview(); + float zoomElement = 0.5f / mat.m0; rlBegin(RL_LINES); rlColor4ub(color.r, color.g, color.b, color.a); - rlVertex2f((float)posX, (float)posY); - rlVertex2f((float)posX + (float)width, (float)posY); + rlVertex2f((float)posX - zoomElement, (float)posY); + rlVertex2f((float)posX + (float)width + zoomElement, (float)posY); - rlVertex2f((float)posX + (float)width, (float)posY); - rlVertex2f((float)posX + (float)width, (float)posY + (float)height); + rlVertex2f((float)posX + (float)width, (float)posY - zoomElement); + rlVertex2f((float)posX + (float)width, (float)posY + (float)height + zoomElement); - rlVertex2f((float)posX + (float)width, (float)posY + (float)height); - rlVertex2f((float)posX, (float)posY + (float)height); + rlVertex2f((float)posX + (float)width + zoomElement, (float)posY + (float)height); + rlVertex2f((float)posX - zoomElement, (float)posY + (float)height); - rlVertex2f((float)posX, (float)posY + (float)height); - rlVertex2f((float)posX, (float)posY); + rlVertex2f((float)posX, (float)posY + (float)height + zoomElement); + rlVertex2f((float)posX, (float)posY - zoomElement); rlEnd(); }