pass all button params to the icon

This commit is contained in:
Kartik K. Agaram 2022-08-23 12:13:22 -07:00
parent 8747415461
commit b6f42ebf01
2 changed files with 3 additions and 2 deletions

View File

@ -14,7 +14,7 @@ function button(State, name, params)
end
love.graphics.setColor(params.color[1], params.color[2], params.color[3])
love.graphics.rectangle('fill', params.x,params.y, params.w,params.h, 5,5)
if params.icon then params.icon(params.x, params.y) end
if params.icon then params.icon(params) end
table.insert(State.button_handlers, params)
end

View File

@ -1,6 +1,7 @@
icon = {}
function icon.insert_drawing(x, y)
function icon.insert_drawing(button_params)
local x,y = button_params.x, button_params.y
App.color(Icon_color)
love.graphics.rectangle('line', x,y, 12,12)
love.graphics.line(4,y+6, 16,y+6)