31 lines
825 B
Plaintext
31 lines
825 B
Plaintext
draw_file_dialog = function()
|
|
draw_file_dialog_input()
|
|
App.color(Menu_background)
|
|
love.graphics.rectangle('fill',
|
|
Menu_left+5,
|
|
Menu_bottom+5,
|
|
Safe_width-Menu_left-10,
|
|
Safe_height-Menu_bottom-10)
|
|
if Directory_contents == nil then
|
|
-- on the first frame after dialog is enabled
|
|
refresh_directory_contents()
|
|
end
|
|
local x, y = Menu_left+10, Menu_bottom+10
|
|
for _,filename in ipairs(Directory_contents) do
|
|
if filename:find(File_dialog_input_text) then
|
|
local w = App.width(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()
|
|
File_dialog_callback(filename)
|
|
reset_file_dialog_state()
|
|
end)
|
|
x = x+w+10
|
|
end
|
|
end
|
|
end |