Fix bugs related to the first time launching game

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-25 16:15:41 +07:00
parent dfeece9ddc
commit 9e1c8d4680
4 changed files with 31 additions and 10 deletions

View File

@@ -14,10 +14,15 @@ local snapUnit = 1
local hasChanged
---@type function
local exitSceneFunc = function()
local function exitSceneFunc(saved)
VCTRL.release()
BUTTON.release(buttonList)
SCENE = TitleScene()
if SETTINGS.firstTime and not saved then
SCENE = InputConfigScene(true)
else
SCENE = TitleScene()
SETTINGS.firstTime = false
end
end
buttonList = {
@@ -51,7 +56,7 @@ buttonList = {
text = "MENU",
x = 570, y = 5, w = 60, h = 25,
codeWhenReleased = function()
if hasChanged then
if hasChanged or SETTINGS.firstTime then
local selection = love.window.showMessageBox(
"Save config?", "Do you want to save your changes before exiting?",
{"Save", "Discard", "Keep editing", escapebutton = 2, enterbutton = 1},
@@ -59,10 +64,9 @@ buttonList = {
)
if selection == 1 then
SETTINGS.input.virtual = VCTRL.exportAll()
SETTINGS.firstTime = false
-- love.window.showMessageBox("Saved!", "Your changes was saved!")
exitSceneFunc()
exitSceneFunc(true)
elseif selection == 2 then
VCTRL.clearAll()
VCTRL.new(SETTINGS.input.virtual)
@@ -141,12 +145,12 @@ local function sliderList_update()
end
end
function TouchConfigScene:new()
function TouchConfigScene:new(fromPreviewScene)
VCTRL.toggle(true)
VCTRL.focus = nil
focusingButton = nil
hasChanged = false
hasChanged = fromPreviewScene
Grid:new(10, 20)
-- TODO
end