diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-05-17 23:24:46 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-05-17 23:24:46 -0700 |
commit | dc618a419c3e4c0fb3519b294dc741ad0b2221be (patch) | |
tree | 798745331a4550fd093551df99304ccac250e184 | |
parent | b544e8c3576aec557f384c5d31224c6cfe625de7 (diff) | |
download | lines.love-dc618a419c3e4c0fb3519b294dc741ad0b2221be.tar.gz |
highlight another global
-rw-r--r-- | button.lua | 6 | ||||
-rw-r--r-- | main.lua | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/button.lua b/button.lua index cc48b26..42c44e3 100644 --- a/button.lua +++ b/button.lua @@ -1,18 +1,18 @@ -- simple immediate-mode buttons -button_handlers = {} +Button_handlers = {} -- draw button and queue up event handlers function button(name, params) 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 - table.insert(button_handlers, params) + table.insert(Button_handlers, params) end -- process button event handlers function propagate_to_button_handlers(x, y, mouse_button) - for _,ev in ipairs(button_handlers) do + 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 mouse_button == 1 then ev.onpress1() end end diff --git a/main.lua b/main.lua index 3279dde..d95c259 100644 --- a/main.lua +++ b/main.lua @@ -95,7 +95,7 @@ function love.filedropped(file) end function love.draw() - button_handlers = {} + Button_handlers = {} love.graphics.setColor(1, 1, 1) love.graphics.rectangle('fill', 0, 0, Screen_width-1, Screen_height-1) love.graphics.setColor(0, 0, 0) |