@@ -60,16 +60,17 @@ internal Rectangle(BaseRenderer renderer)
6060 /// <param name="color">The color, or a null reference.</param>
6161 /// <param name="textureCoordinates">The texture coordinates to be applied</param>
6262 /// <param name="wrapMode">A wrap mode if overriding that of the texture</param>
63- public void DrawAlpha ( Texture texture , Vector2 point , Vector2 size , Color128 ? color = null , Vector2 ? textureCoordinates = null , OpenGlTextureWrapMode ? wrapMode = null )
63+ /// <param name="cornerRadius">Corner radius in pixels for rounded corners</param>
64+ public void DrawAlpha ( Texture texture , Vector2 point , Vector2 size , Color128 ? color = null , Vector2 ? textureCoordinates = null , OpenGlTextureWrapMode ? wrapMode = null , float cornerRadius = 0f )
6465 {
6566 renderer . UnsetBlendFunc ( ) ;
6667 renderer . SetAlphaFunc ( AlphaFunction . Equal , 1.0f ) ;
6768 GL . DepthMask ( true ) ;
68- Draw ( texture , point , size , color , textureCoordinates , wrapMode ) ;
69+ Draw ( texture , point , size , color , textureCoordinates , wrapMode , cornerRadius ) ;
6970 renderer . SetBlendFunc ( ) ;
7071 renderer . SetAlphaFunc ( AlphaFunction . Less , 1.0f ) ;
7172 GL . DepthMask ( false ) ;
72- Draw ( texture , point , size , color , textureCoordinates , wrapMode ) ;
73+ Draw ( texture , point , size , color , textureCoordinates , wrapMode , cornerRadius ) ;
7374 renderer . SetAlphaFunc ( AlphaFunction . Equal , 1.0f ) ;
7475 }
7576
@@ -102,17 +103,18 @@ public void DrawAlpha(Texture texture, Vector2 point, Color128? color = null, Ve
102103 /// <param name="color">The color, or a null reference.</param>
103104 /// <param name="textureCoordinates">The texture coordinates to be applied</param>
104105 /// <param name="wrapMode">A wrap mode if overriding that of the texture</param>
105- public void Draw ( Texture texture , Vector2 point , Vector2 size , Color128 ? color = null , Vector2 ? textureCoordinates = null , OpenGlTextureWrapMode ? wrapMode = null )
106+ /// <param name="cornerRadius">Corner radius in pixels for rounded corners</param>
107+ public void Draw ( Texture texture , Vector2 point , Vector2 size , Color128 ? color = null , Vector2 ? textureCoordinates = null , OpenGlTextureWrapMode ? wrapMode = null , float cornerRadius = 0f )
106108 {
107109 if ( renderer . AvailableNewRenderer && Shader != null )
108110 {
109111 if ( textureCoordinates == null )
110112 {
111- DrawWithShader ( texture , point , size , color , Vector2 . One , wrapMode ) ;
113+ DrawWithShader ( texture , point , size , color , Vector2 . One , wrapMode , cornerRadius ) ;
112114 }
113115 else
114116 {
115- DrawWithShader ( texture , point , size , color , ( Vector2 ) textureCoordinates , wrapMode ) ;
117+ DrawWithShader ( texture , point , size , color , ( Vector2 ) textureCoordinates , wrapMode , cornerRadius ) ;
116118 }
117119 }
118120 else
@@ -234,7 +236,7 @@ private void DrawImmediate(Texture texture, Vector2 point, Vector2 size, Color12
234236 GL . PopMatrix ( ) ;
235237 }
236238
237- private void DrawWithShader ( Texture texture , Vector2 point , Vector2 size , Color128 ? color , Vector2 coordinates , OpenGlTextureWrapMode ? wrapMode = null )
239+ private void DrawWithShader ( Texture texture , Vector2 point , Vector2 size , Color128 ? color , Vector2 coordinates , OpenGlTextureWrapMode ? wrapMode = null , float cornerRadius = 0f )
238240 {
239241 Shader . Activate ( ) ;
240242 if ( wrapMode == null )
@@ -258,6 +260,7 @@ private void DrawWithShader(Texture texture, Vector2 point, Vector2 size, Color1
258260 Shader . SetPoint ( point ) ;
259261 Shader . SetSize ( size ) ;
260262 Shader . SetCoordinates ( coordinates ) ;
263+ Shader . SetCornerRadius ( cornerRadius ) ;
261264 /*
262265 * In order to call GL.DrawArrays with procedural data within the shader,
263266 * we first need to bind a dummy VAO
0 commit comments