about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-08-23 12:13:22 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-08-23 12:13:22 -0700
commitb6f42ebf01b6738458b37ff255f55854dea20adc (patch)
tree46c407c2098e90a3505d65e2e041ab8379f7287c
parent8747415461a921dd26cc2610471ddb411db0ed16 (diff)
downloadtext.love-b6f42ebf01b6738458b37ff255f55854dea20adc.tar.gz
pass all button params to the icon
-rw-r--r--button.lua2
-rw-r--r--icons.lua3
2 files changed, 3 insertions, 2 deletions
diff --git a/button.lua b/button.lua
index c027b5c..d8ab601 100644
--- a/button.lua
+++ b/button.lua
@@ -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
 
diff --git a/icons.lua b/icons.lua
index 19939cf..175fb13 100644
--- a/icons.lua
+++ b/icons.lua
@@ -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)