30 lines
773 B
Plaintext
30 lines
773 B
Plaintext
|
draw_file_dialog = function()
|
||
|
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
|
||
|
local w = App.width(filename) + 10
|
||
|
if x == Menu_left+10 or x+w < Safe_width-Menu_left-10 then
|
||
|
styled_button(filename, x,y, function()
|
||
|
File_dialog_callback(filename)
|
||
|
Show_file_dialog = false
|
||
|
File_dialog_callback = nil
|
||
|
end)
|
||
|
x = x+w+10
|
||
|
else
|
||
|
x = Menu_left+10
|
||
|
y = y+Line_height+10
|
||
|
if y > Safe_height-Menu_bottom-10 then
|
||
|
break
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|