sokoban.love/0110-maybe_draw_overflow_bu...

17 lines
483 B
Plaintext

maybe_draw_overflow_button = function(x, y, w, r, final_button)
if Overflow_button then return x, y end
local after = x+w
if not final_button then
local w2 = Font:getWidth('>>')+10
-- only draw a button if there's going to be at least space for the overflow button afterwards
after = after+10+w2
end
if after > r then
x, y = overflow_button(x, y)
Overflow_button = Global_state.button_handlers[#Global_state.button_handlers]
return x, y
else
return x, y
end
end