This is the extended version of 'fillRect', which adds an extra parameter, 'radius', for rounding the corners.
Fills 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 fill 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( :white )
setColor( :green )
6.times() do |x|
4.times() do |y|
fillRoundedRect(55 + 85*x, 40 + 80*y, 75, 75, y*10 + x)
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.