mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
33 lines
789 B
Lua
33 lines
789 B
Lua
local bitser = require 'libs.bitser'
|
|
local fs = love.filesystem
|
|
|
|
local _settings = fs.read(CONFIG_FILE) ~= nil and bitser.loadLoveFile(CONFIG_FILE) or {}
|
|
local _defaultSettings = {
|
|
firstTime = true,
|
|
|
|
fullscreen = false,
|
|
music = true,
|
|
lines = true,
|
|
|
|
---@class input
|
|
---@field keys table <string, string>
|
|
---@field joysticks table <string, string>
|
|
---@field touch table <string, string>
|
|
input = {
|
|
keys = {},
|
|
joysticks = {},
|
|
}
|
|
}
|
|
|
|
SETTINGS = setmetatable(
|
|
{},
|
|
{
|
|
__index = function(_, k)
|
|
return _settings[k] == nil and _defaultSettings[k] or _settings[k]
|
|
end,
|
|
__newindex = function(_, k, v)
|
|
_settings[k] = v
|
|
bitser.dumpLoveFile(CONFIG_FILE,_settings)
|
|
end
|
|
}
|
|
) |