Files
tromi_mobile/load/save.lua
Squishy (C6H12O6+NaCl+H2O) f56bde14b9 Replace `binser with bitser`
2024-04-12 21:00:57 +07:00

29 lines
620 B
Lua

local bitser = require 'libs.bitser'
local fs = love.filesystem
function loadSave()
config = loadFromFile(CONFIG_FILE)
end
function loadFromFile(filename)
if fs.read(filename) == nil then
return {} -- new object
end
return bitser.loadLoveFile(filename)
end
function initConfig()
if config.fullscreen == nil then config.fullscreen = false end
if config.music == nil then config.music = true end
if not config.input then
scene = InputConfigScene(true)
else
scene = TitleScene()
end
end
function saveConfig()
bitser.dumpLoveFile(CONFIG_FILE, config)
end