about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-17 23:18:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-17 23:18:56 -0700
commit6e152a9f3fc8dcae132874e9ea967bbf211fc5aa (patch)
treef3c372f00c47e99d664ff6376490f49dd618eb43
parentc1ba40ac70a634d90ce7345cc5f8509116bd51ff (diff)
downloadlines.love-6e152a9f3fc8dcae132874e9ea967bbf211fc5aa.tar.gz
.
-rw-r--r--button.lua6
-rw-r--r--main.lua4
2 files changed, 6 insertions, 4 deletions
diff --git a/button.lua b/button.lua
index 10f32ff..cc48b26 100644
--- a/button.lua
+++ b/button.lua
@@ -1,3 +1,5 @@
+-- simple immediate-mode buttons
+
 button_handlers = {}
 
 -- draw button and queue up event handlers
@@ -9,10 +11,10 @@ function button(name, params)
 end
 
 -- process button event handlers
-function propagate_to_button_handlers(x, y, button)
+function propagate_to_button_handlers(x, y, mouse_button)
   for _,ev in ipairs(button_handlers) do
     if x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h then
-      if ev.onpress1 and button == 1 then ev.onpress1() end
+      if ev.onpress1 and mouse_button == 1 then ev.onpress1() end
     end
   end
 end
diff --git a/main.lua b/main.lua
index 95bdc50..cd65f2d 100644
--- a/main.lua
+++ b/main.lua
@@ -129,8 +129,8 @@ function love.update(dt)
   Drawing.update(dt)
 end
 
-function love.mousepressed(x,y, button)
-  propagate_to_button_handlers(x,y, button)
+function love.mousepressed(x,y, mouse_button)
+  propagate_to_button_handlers(x,y, mouse_button)
 
   for line_index,line in ipairs(Lines) do
     if line.mode == 'text' then