Change special code, add a way to skip keys

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-26 21:30:56 +07:00
parent 4b001cdf57
commit 478a8bf49e
5 changed files with 47 additions and 34 deletions

View File

@@ -54,20 +54,20 @@ function KeyConfigScene:render()
end
end
if self.input_state > #configurable_inputs then
drawText("Press enter to confirm, delete/backspace to retry" .. (SETTINGS.input and ", escape to cancel" or ""),0,0,1000)
drawText("Press Enter/Confirm Selection to confirm, delete/backspace to retry" .. (SETTINGS.input and ", escape/Go Back to cancel" or ""),0,0,1000)
else
drawText("Press key input for " .. input_names[configurable_inputs[self.input_state]] .. ", tab to skip, escape to cancel",0,0,1000)
drawText("Function keys (F1, F2, etc.), escape, and tab can't be changed", 0, 20,1000)
drawText("Press any key from other input than keyboard will also skip.\nFunction keys (F1, F2, etc.), escape, and tab can't be changed", 0, 20,1000)
end
end
function KeyConfigScene:onInputPress(e)
if e.type == "key" then
-- function keys, escape, and tab are reserved and can't be remapped
if e.scancode == "escape" then
if e.scancode == "escape" or (self.input_state > #configurable_inputs and e.input == "menu_back") then
SCENE = InputConfigScene(SETTINGS.firstTime)
elseif self.input_state > #configurable_inputs then
if e.scancode == "return" then
if e.scancode == "return" or e.input == "menu_decide" then
SETTINGS.input.keys = self.new_input
SCENE = SETTINGS.firstTime and TitleScene() or InputConfigScene()
SETTINGS.firstTime = false
@@ -86,6 +86,9 @@ function KeyConfigScene:onInputPress(e)
self.new_input[e.scancode] = configurable_inputs[self.input_state]
self.input_state = self.input_state + 1
end
elseif self.input_state < #configurable_inputs then
self.set_inputs[configurable_inputs[self.input_state]] = "skipped"
self.input_state = self.input_state + 1
end
end