@@ -807,22 +807,25 @@ void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Col
807
807
// but it solves another issue: https://github.com/raysan5/raylib/issues/3884
808
808
void DrawRectangleLines (int posX , int posY , int width , int height , Color color )
809
809
{
810
- Matrix mat = rlGetMatrixModelview ();
811
- float zoomFactor = 0.5f /mat .m0 ;
810
+ Matrix mat = rlGetMatrixTransform ();
811
+ float xOffset = 0.5f /mat .m0 ;
812
+ float yOffset = 0.5f /mat .m5 ;
813
+
812
814
rlBegin (RL_LINES );
813
815
rlColor4ub (color .r , color .g , color .b , color .a );
814
- rlVertex2f ((float )posX - zoomFactor , (float )posY );
815
- rlVertex2f ((float )posX + (float )width + zoomFactor , (float )posY );
816
+ rlVertex2f ((float )posX + xOffset , (float )posY + yOffset );
817
+ rlVertex2f ((float )posX + (float )width - xOffset , (float )posY + yOffset );
816
818
817
- rlVertex2f ((float )posX + (float )width , (float )posY - zoomFactor );
818
- rlVertex2f ((float )posX + (float )width , (float )posY + (float )height + zoomFactor );
819
+ rlVertex2f ((float )posX + (float )width - xOffset , (float )posY + yOffset );
820
+ rlVertex2f ((float )posX + (float )width - xOffset , (float )posY + (float )height - yOffset );
819
821
820
- rlVertex2f ((float )posX + (float )width + zoomFactor , (float )posY + (float )height );
821
- rlVertex2f ((float )posX - zoomFactor , (float )posY + (float )height );
822
+ rlVertex2f ((float )posX + (float )width - xOffset , (float )posY + (float )height - yOffset );
823
+ rlVertex2f ((float )posX + xOffset , (float )posY + (float )height - yOffset );
822
824
823
- rlVertex2f ((float )posX , (float )posY + (float )height + zoomFactor );
824
- rlVertex2f ((float )posX , (float )posY - zoomFactor );
825
+ rlVertex2f ((float )posX + xOffset , (float )posY + (float )height - yOffset );
826
+ rlVertex2f ((float )posX + xOffset , (float )posY + yOffset );
825
827
rlEnd ();
828
+
826
829
/*
827
830
// Previous implementation, it has issues... but it does not require view matrix...
828
831
#if defined(SUPPORT_QUADS_DRAW_MODE)
@@ -845,7 +848,7 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
845
848
rlVertex2f((float)posX + 1, (float)posY + (float)height);
846
849
rlVertex2f((float)posX + 1, (float)posY + 1);
847
850
rlEnd();
848
- // #endif
851
+ #endif
849
852
*/
850
853
}
851
854
0 commit comments