Add cornerRadius option to override theme corner radius

This commit is contained in:
Andrew Minnich 2016-03-05 16:20:43 -05:00
parent 5298f31d06
commit 01f7cd88fb
2 changed files with 6 additions and 1 deletions

View file

@ -166,6 +166,9 @@ Common Options
``color``
A table to overwrite the color. Undefined colors default to the theme colors.
``cornerRadius``
The corner radius for boxes. Overwrites the theme corner radius.
``draw``
A function to replace the drawing function. Refer to :doc:`themes` for more information about the function signatures.

View file

@ -20,8 +20,10 @@ end
function theme.drawBox(x,y,w,h, opt, colors)
local colors = colors or theme.getColorForState(opt)
local cornerRadius = opt.cornerRadius or theme.cornerRadius
love.graphics.setColor(colors.bg)
love.graphics.rectangle('fill', x,y, w,h, theme.cornerRadius)
love.graphics.rectangle('fill', x,y, w,h, cornerRadius)
end
function theme.getVerticalOffsetForAlign(valign, font, h)