dcearth/savemodal.lua

52 lines
1011 B
Lua
Raw Normal View History

2024-04-29 01:21:32 +00:00
local love = assert( love )
local modal = require( "modal" )
local button = require( "button" )
local map = require( "map" )
local t = {}
local saveLocation = map.path
local saveButton = button.new{
group = "saveModal",
name = "save",
callback = function() map.save(); return t:stop() end,
visible = false,
x = 20,
y = 20,
w = 400,
h = 100,
}
local cancelButton = button.new{
group = "saveModal",
name = "cancel",
visible = false,
callback = function() return t:stop() end,
x = 20,
y = 150,
w = 400,
h = 100
}
function t.start()
modal.start( t )
button.selected = saveButton
saveButton.name = "save to "..map.path
button.displayGroup( "saveModal", true )
end
function t.draw()
love.graphics.clear( 0,0,0,1 )
love.graphics.setColor( 1, 1, 1, 0.5 )
button:draw()
end
function t.directorydropped( path )
saveLocation = path
map.path = path
saveButton.name = "save to "..map.path
return love.filesystem.mount( path, "" )
end
return modal.new( t )