mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Update virtual control stuff
This commit is contained in:
@@ -2,7 +2,7 @@ local bitser = require 'libs.bitser'
|
||||
local fs = love.filesystem
|
||||
|
||||
function loadSave()
|
||||
config = loadFromFile(CONFIG_FILE)
|
||||
-- config = loadFromFile(CONFIG_FILE)
|
||||
end
|
||||
|
||||
function loadFromFile(filename)
|
||||
@@ -13,16 +13,53 @@ function loadFromFile(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
|
||||
|
||||
-- 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
|
||||
|
||||
local _config = loadFromFile(CONFIG_FILE) or {}
|
||||
local _defaultConfig = {
|
||||
firstTime = true,
|
||||
|
||||
fullscreen = false,
|
||||
music = true,
|
||||
|
||||
input = {
|
||||
keys = {},
|
||||
mobile = { -- Should not be changed for any reason, used for mobile only
|
||||
enter = 'menu_decide',
|
||||
f13 = 'up',
|
||||
f14 = 'down',
|
||||
f15 = 'left',
|
||||
f16 = 'right',
|
||||
f17 = 'rotate_left',
|
||||
f18 = 'rotate_left2',
|
||||
f19 = 'rotate_right',
|
||||
f20 = 'rotate_right2',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function saveConfig()
|
||||
bitser.dumpLoveFile(CONFIG_FILE, config)
|
||||
bitser.dumpLoveFile(CONFIG_FILE, _config)
|
||||
end
|
||||
|
||||
|
||||
config = setmetatable(
|
||||
{},
|
||||
{
|
||||
__index = function(_, k)
|
||||
if _config[k] == nil then _config[k] = _defaultConfig[k] end
|
||||
return _config[k]
|
||||
end,
|
||||
__newindex = function(_, k, v)
|
||||
_config[k] = v
|
||||
saveConfig()
|
||||
end
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user