From 01f7cd88fb0d145af16bdc77681626a15891c4e1 Mon Sep 17 00:00:00 2001 From: Andrew Minnich Date: Sat, 5 Mar 2016 16:20:43 -0500 Subject: [PATCH] Add cornerRadius option to override theme corner radius --- docs/widgets.rst | 3 +++ theme.lua | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/widgets.rst b/docs/widgets.rst index 3f2fb44..0e78a0c 100644 --- a/docs/widgets.rst +++ b/docs/widgets.rst @@ -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. diff --git a/theme.lua b/theme.lua index ea26e8a..2318319 100644 --- a/theme.lua +++ b/theme.lua @@ -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)