mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
30 lines
661 B
Lua
30 lines
661 B
Lua
local binser = require 'libs.binser'
|
|
local fs = love.filesystem
|
|
|
|
function loadSave()
|
|
config = loadFromFile(CONFIG_FILE)
|
|
end
|
|
|
|
function loadFromFile(filename)
|
|
local save_data = fs.read(filename)
|
|
if save_data == nil then
|
|
return {} -- new object
|
|
end
|
|
return binser.deserialize(save_data)[1]
|
|
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()
|
|
fs.write(CONFIG_FILE,binser.serialize(config))
|
|
end
|