mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
first commit
This commit is contained in:
29
load/save.lua
Normal file
29
load/save.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
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
|
||||
Reference in New Issue
Block a user