Merge carousel.love

This commit is contained in:
Kartik K. Agaram 2024-05-20 01:09:35 -07:00
commit fecff08fcf
5 changed files with 8 additions and 4 deletions

View File

@ -26,7 +26,7 @@ on.draw = function()
--
draw_menu()
draw_next_frames_of_animations()
if Window_in_focus then
if Window_in_focus and Mouse_on_window then
draw_button_tooltips(Global_state)
end
end

View File

@ -1 +1 @@
Window_focus = true
Window_in_focus = true

1
0179-Mouse_on_window Normal file
View File

@ -0,0 +1 @@
Mouse_on_window = true

3
0180-on.mouse_focus Normal file
View File

@ -0,0 +1,3 @@
on.mouse_focus = function(in_focus)
Mouse_on_window = in_focus
end

View File

@ -22,7 +22,7 @@ function mouse_press_consumed_by_any_button(State, x, y, mouse_button)
local button_pressed = false
local consume_press = true
for _,ev in ipairs(State.button_handlers) do
if x>ev.x and x<ev.x+ev.w-1 and y>ev.y and y<ev.y+ev.h-1 then
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
button_pressed = true
if ev.onpress1() then
@ -39,7 +39,7 @@ function draw_button_tooltips(State)
local x,y = love.mouse.getPosition()
for _,ev in ipairs(State.button_handlers) do
if ev.tooltip then
if x>ev.x and x<ev.x+ev.w-1 and y>ev.y and y<ev.y+ev.h-1 then
if x>ev.x and x<ev.x+ev.w and y>ev.y and y<ev.y+ev.h then
ev.tooltip(x,y)
end
end