Update virtual control stuff

This commit is contained in:
SweetSea-ButImNotSweet
2024-04-19 12:53:13 +07:00
parent aefc660dd4
commit cedc6e888e
6 changed files with 96 additions and 81 deletions

View File

@@ -31,7 +31,7 @@ local input_names = {
rotate_right='Rotate Clockwise',
rotate_right2='Rotate Clockwise (2)'
}
local function newSetInputs()
local set_inputs = {}
@@ -73,12 +73,10 @@ function KeyConfigScene:onInputPress(e)
scene = InputConfigScene()
elseif self.input_state > table.getn(configurable_inputs) then
if e.scancode == "return" then
-- save new input, then load next scene
local had_config = config.input ~= nil
if not config.input then config.input = {} end
config.input.keys = self.new_input
saveConfig()
scene = had_config and InputConfigScene() or TitleScene()
scene = config.firstTime and TitleScene() or InputConfigScene()
config.firstTime = false
elseif e.scancode == "delete" or e.scancode == "backspace" then
-- retry
self.input_state = 1
@@ -88,7 +86,7 @@ function KeyConfigScene:onInputPress(e)
elseif e.scancode == "tab" then
self.set_inputs[configurable_inputs[self.input_state]] = "skipped"
self.input_state = self.input_state + 1
elseif e.scancode ~= "escape" and not self.new_input[e.scancode] then
elseif not self.new_input[e.scancode] then
-- all other keys can be configured
self.set_inputs[configurable_inputs[self.input_state]] = "key " .. love.keyboard.getKeyFromScancode(e.scancode) .. " (" .. e.scancode .. ")"
self.new_input[e.scancode] = configurable_inputs[self.input_state]