This is the extended version of 'drawRect', which adds an extra parameter, 'radius', for rounding the corners.
drawRoundedRect( x, y, width, height, radius, isCentred=false )
Draws a rectangle at the x/y location given. 'Width' and 'height' are the total size of the rectangle. The optional 'isCentred' allows you to state if x/y refers to the top-left corner, or the middle, of the rectangle.
Corners are turned into a 90 degree arc. This functions takes a 'radius' parameter, which is the distance from the edge of the arc to it's centre. This is also the width and height of these rounded corners.
The radius is capped between 0, which will draw a normal rectangle, and the maximum value allowed before the corners become bigger then the rectangle. This is to prevent drawing errors.
* A range of rounded rectangles.
fill( :blue )
setColor( :white )
6.times() do |x|
4.times() do |y|
drawRoundedRect(55 + 85*x, 40 + 80*y, 75, 75, y*10 + x)
drawRoundedRect( x, y, width, height, radius, xAlign, yAlign )
This is the same function, but allows you to specify x and y axis alignment. See the article on How Alignment Works for more details.