Added Save/Load/Export functionality

This commit is contained in:
nucular 2014-07-28 18:40:04 +02:00
parent af2f3de4f4
commit 85b66115ed

View File

@ -354,19 +354,55 @@ function createActionButtons()
playbutton = b playbutton = b
f:AddItem(b) f:AddItem(b)
local fr = lf.Create("frame")
fr:SetSize(300, 105)
fr:Center()
fr:SetVisible(false)
fr:SetModal(false)
fr.OnClose = function(o)
fr:SetVisible(false):SetModal(false)
return false
end
local frb = lf.Create("button", fr)
frb:SetText("Okay")
frb:SetPos(5, 70)
frb.OnClick = function(o)
fr:SetVisible(false):SetModal(false)
end
local frt = lf.Create("text", fr)
frt:SetPos(5, 30)
local sb = lf.Create("button") local sb = lf.Create("button")
sb:SetText("Save") sb:SetText("Save")
sb:SetWidth(67) sb:SetWidth(67)
sb.OnClick = function(o)
local p = love.filesystem.getSaveDirectory() .. "/" .. "sound.lua"
sound:save(p, true)
frt:SetText("Saved to\n" .. p)
fr:SetVisible(true):SetModal(true):Center()
end
f:AddItem(sb) f:AddItem(sb)
local lb = lf.Create("button") local lb = lf.Create("button")
lb:SetText("Load") lb:SetText("Load")
lb:SetWidth(67) lb:SetWidth(67)
lb.OnClick = function(o)
local p = love.filesystem.getSaveDirectory() .. "/" .. "sound.lua"
sound:load(p)
frt:SetText("Loaded from\n" .. p)
fr:SetVisible(true):SetModal(true):Center()
end
f:AddItem(lb) f:AddItem(lb)
local eb = lf.Create("button") local eb = lf.Create("button")
eb:SetText("Export WAV") eb:SetText("Export WAV")
eb:SetWidth(140) eb:SetWidth(140)
eb.OnClick = function(o)
local p = love.filesystem.getSaveDirectory() .. "/" .. "sound.wav"
sound:exportWAV(p)
frt:SetText("Exported WAV to\n" .. p)
fr:SetVisible(true):SetModal(true):Center()
end
f:AddItem(eb) f:AddItem(eb)
f:SetPos(485, 485) f:SetPos(485, 485)