sokoban.love/0188-add_files_to_dialog

23 lines
650 B
Plaintext
Raw Normal View History

add_files_to_dialog = function(contents, x,y, colorfn)
for _,filename in ipairs(contents) do
if filename:find(File_dialog_input_text) then
local w = Font:getWidth(filename) + 10
if x ~= Menu_left+10 and x+w > Safe_width-Menu_left-10 then
x = Menu_left+10
y = y+Line_height+10
if y > Safe_height-Menu_bottom-10 then
break
end
end
styled_button(filename, x,y, function()
-- TODO: File_dialog_callback needs to somehow know to load stashed files.
File_dialog_callback(filename)
reset_file_dialog_state()
end,
--[[tooltip text]] nil,
colorfn(filename))
x = x+w+10
end
end
return y
end