Revert "Separate in-game bindings from menu bindings"
This reverts commit 0fce4b632f
.
This commit caused issue #41. Will resolve ASAP.
pull/43/head
parent
0fce4b632f
commit
7495c4ad04
|
@ -1 +1 @@
|
|||
version = "v0.3.1"
|
||||
version = "v0.3"
|
|
@ -13,7 +13,6 @@ GameScene = require "scene.game"
|
|||
ModeSelectScene = require "scene.mode_select"
|
||||
KeyConfigScene = require "scene.key_config"
|
||||
StickConfigScene = require "scene.stick_config"
|
||||
MenuConfigScene = require "scene.menu_config"
|
||||
InputConfigScene = require "scene.input_config"
|
||||
GameConfigScene = require "scene.game_config"
|
||||
TuningScene = require "scene.tuning"
|
||||
|
|
|
@ -80,7 +80,8 @@ function CreditsScene:render()
|
|||
end
|
||||
|
||||
function CreditsScene:onInputPress(e)
|
||||
if e.input == "menu_decide" or e.input == "menu_back" then
|
||||
if e.input == "menu_decide" or e.scancode == "return" or
|
||||
e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
||||
scene = TitleScene()
|
||||
switchBGM(nil)
|
||||
end
|
||||
|
|
|
@ -84,17 +84,17 @@ function ConfigScene:render()
|
|||
end
|
||||
|
||||
function ConfigScene:onInputPress(e)
|
||||
if e.input == "menu_decide" then
|
||||
if e.input == "menu_decide" or e.scancode == "return" then
|
||||
playSE("mode_decide")
|
||||
saveConfig()
|
||||
scene = SettingsScene()
|
||||
elseif e.input == "menu_up" then
|
||||
elseif e.input == "up" or e.scancode == "up" then
|
||||
playSE("cursor")
|
||||
self.highlight = Mod1(self.highlight-1, optioncount)
|
||||
elseif e.input == "menu_down" then
|
||||
elseif e.input == "down" or e.scancode == "down" then
|
||||
playSE("cursor")
|
||||
self.highlight = Mod1(self.highlight+1, optioncount)
|
||||
elseif e.input == "menu_left" then
|
||||
elseif e.input == "left" or e.scancode == "left" then
|
||||
if not self.options[self.highlight][3] then
|
||||
playSE("cursor_lr")
|
||||
local option = ConfigScene.options[self.highlight]
|
||||
|
@ -105,7 +105,7 @@ function ConfigScene:onInputPress(e)
|
|||
sld:update()
|
||||
playSE("cursor")
|
||||
end
|
||||
elseif e.input == "menu_right" then
|
||||
elseif e.input == "right" or e.scancode == "right" then
|
||||
if not self.options[self.highlight][3] then
|
||||
playSE("cursor_lr")
|
||||
local option = ConfigScene.options[self.highlight]
|
||||
|
@ -116,7 +116,7 @@ function ConfigScene:onInputPress(e)
|
|||
sld:update()
|
||||
playSE("cursor")
|
||||
end
|
||||
elseif e.input == "menu_back" then
|
||||
elseif e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
||||
loadSave()
|
||||
scene = SettingsScene()
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
local ConfigScene = Scene:extend()
|
||||
|
||||
ConfigScene.title = "Game Controls"
|
||||
ConfigScene.title = "Input Config"
|
||||
|
||||
local menu_screens = {
|
||||
KeyConfigScene,
|
||||
|
@ -27,7 +27,7 @@ function ConfigScene:render()
|
|||
)
|
||||
|
||||
love.graphics.setFont(font_3x5_4)
|
||||
love.graphics.print("IN-GAME CONTROLS", 80, 40)
|
||||
love.graphics.print("INPUT CONFIG", 80, 40)
|
||||
|
||||
love.graphics.setFont(font_3x5_2)
|
||||
love.graphics.print("Which controls do you want to configure?", 80, 90)
|
||||
|
@ -48,17 +48,18 @@ function ConfigScene:changeOption(rel)
|
|||
end
|
||||
|
||||
function ConfigScene:onInputPress(e)
|
||||
local had_config = config.input ~= nil
|
||||
if e.input == "menu_decide" or (not had_config and e.scancode == "return") then
|
||||
if e.input == "menu_decide" or e.scancode == "return" then
|
||||
playSE("main_decide")
|
||||
scene = menu_screens[self.menu_state]()
|
||||
elseif e.input == "menu_up" or (not had_config and e.scancode == "up") then
|
||||
elseif e.input == "up" or e.scancode == "up" then
|
||||
self:changeOption(-1)
|
||||
playSE("cursor")
|
||||
elseif e.input == "menu_down" or (not had_config and e.scancode == "down") then
|
||||
elseif e.input == "down" or e.scancode == "down" then
|
||||
self:changeOption(1)
|
||||
playSE("cursor")
|
||||
elseif had_config and e.input == "menu_back" then
|
||||
elseif config.input and (
|
||||
e.input == "menu_back" or e.scancode == "backspace" or e.scancode == "delete"
|
||||
) then
|
||||
scene = SettingsScene()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,6 +5,8 @@ KeyConfigScene.title = "Key Config"
|
|||
require 'load.save'
|
||||
|
||||
local configurable_inputs = {
|
||||
"menu_decide",
|
||||
"menu_back",
|
||||
"left",
|
||||
"right",
|
||||
"up",
|
||||
|
@ -73,15 +75,10 @@ function KeyConfigScene:onInputPress(e)
|
|||
if e.scancode == "return" then
|
||||
-- save new input, then load next scene
|
||||
local had_config = config.input ~= nil
|
||||
if not had_config then
|
||||
config.input = {}
|
||||
config.input.keys = {}
|
||||
end
|
||||
for k, v in pairs(self.new_input) do
|
||||
config.input.keys[k] = v
|
||||
end
|
||||
if not config.input then config.input = {} end
|
||||
config.input.keys = self.new_input
|
||||
saveConfig()
|
||||
scene = had_config and InputConfigScene() or MenuConfigScene()
|
||||
scene = had_config and InputConfigScene() or TitleScene()
|
||||
elseif e.scancode == "delete" or e.scancode == "backspace" then
|
||||
-- retry
|
||||
self.input_state = 1
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
local MenuConfigScene = Scene:extend()
|
||||
|
||||
MenuConfigScene.title = "Menu Controls"
|
||||
|
||||
require 'load.save'
|
||||
|
||||
local configurable_inputs = {
|
||||
"menu_left",
|
||||
"menu_right",
|
||||
"menu_up",
|
||||
"menu_down",
|
||||
"menu_decide",
|
||||
"menu_back",
|
||||
}
|
||||
|
||||
local function newSetInputs()
|
||||
local set_inputs = {}
|
||||
for i, input in ipairs(configurable_inputs) do
|
||||
set_inputs[input] = false
|
||||
end
|
||||
return set_inputs
|
||||
end
|
||||
|
||||
function MenuConfigScene:new()
|
||||
self.input_state = 1
|
||||
self.set_inputs = newSetInputs()
|
||||
self.new_input = {}
|
||||
|
||||
DiscordRPC:update({
|
||||
details = "In settings",
|
||||
state = "Changing key config",
|
||||
})
|
||||
end
|
||||
|
||||
function MenuConfigScene:update()
|
||||
end
|
||||
|
||||
function MenuConfigScene:render()
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
love.graphics.draw(
|
||||
backgrounds["input_config"],
|
||||
0, 0, 0,
|
||||
0.5, 0.5
|
||||
)
|
||||
|
||||
love.graphics.setFont(font_3x5_2)
|
||||
for i, input in ipairs(configurable_inputs) do
|
||||
love.graphics.printf(input, 40, 50 + i * 20, 200, "left")
|
||||
if self.set_inputs[input] then
|
||||
love.graphics.printf(self.set_inputs[input], 240, 50 + i * 20, 300, "left")
|
||||
end
|
||||
end
|
||||
if self.input_state > table.getn(configurable_inputs) then
|
||||
love.graphics.print("press enter to confirm, delete/backspace to retry" .. (config.input and ", escape to cancel" or ""))
|
||||
else
|
||||
love.graphics.print("press key input for " .. configurable_inputs[self.input_state] .. ", tab to skip, escape to cancel", 0, 0)
|
||||
love.graphics.print("function keys (F1, F2, etc.), escape, and tab can't be changed", 0, 20)
|
||||
end
|
||||
end
|
||||
|
||||
function MenuConfigScene:onInputPress(e)
|
||||
if e.type == "key" then
|
||||
-- function keys, escape, and tab are reserved and can't be remapped
|
||||
if e.scancode == "escape" then
|
||||
scene = SettingsScene()
|
||||
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.menu_left ~= nil
|
||||
for k, v in pairs(self.new_input) do
|
||||
config.input.keys[k] = v
|
||||
end
|
||||
saveConfig()
|
||||
scene = had_config and SettingsScene() or TitleScene()
|
||||
elseif e.scancode == "delete" or e.scancode == "backspace" then
|
||||
-- retry
|
||||
self.input_state = 1
|
||||
self.set_inputs = newSetInputs()
|
||||
self.new_input = {}
|
||||
end
|
||||
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
|
||||
-- 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]
|
||||
self.input_state = self.input_state + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return MenuConfigScene
|
|
@ -120,7 +120,7 @@ function ModeSelectScene:onInputPress(e)
|
|||
if e.y ~= 0 then
|
||||
self:changeOption(-e.y)
|
||||
end
|
||||
elseif e.input == "menu_decide" then
|
||||
elseif e.input == "menu_decide" or e.scancode == "return" then
|
||||
current_mode = self.menu_state.mode
|
||||
current_ruleset = self.menu_state.ruleset
|
||||
config.current_mode = current_mode
|
||||
|
@ -132,17 +132,17 @@ function ModeSelectScene:onInputPress(e)
|
|||
rulesets[self.menu_state.ruleset],
|
||||
self.secret_inputs
|
||||
)
|
||||
elseif e.input == "menu_up" then
|
||||
elseif e.input == "up" or e.scancode == "up" then
|
||||
self:changeOption(-1)
|
||||
self.das_up = true
|
||||
self.das_down = nil
|
||||
elseif e.input == "menu_down" then
|
||||
elseif e.input == "down" or e.scancode == "down" then
|
||||
self:changeOption(1)
|
||||
self.das_down = true
|
||||
self.das_up = nil
|
||||
elseif e.input == "menu_left" or e.input == "menu_right" then
|
||||
elseif e.input == "left" or e.input == "right" or e.scancode == "left" or e.scancode == "right" then
|
||||
self:switchSelect()
|
||||
elseif e.input == "menu_back" then
|
||||
elseif e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
||||
scene = TitleScene()
|
||||
elseif e.input then
|
||||
self.secret_inputs[e.input] = true
|
||||
|
@ -150,9 +150,9 @@ function ModeSelectScene:onInputPress(e)
|
|||
end
|
||||
|
||||
function ModeSelectScene:onInputRelease(e)
|
||||
if e.input == "menu_up" then
|
||||
if e.input == "up" or e.scancode == "up" then
|
||||
self.das_up = nil
|
||||
elseif e.input == "menu_down" then
|
||||
elseif e.input == "down" or e.scancode == "down" then
|
||||
self.das_down = nil
|
||||
elseif e.input then
|
||||
self.secret_inputs[e.input] = false
|
||||
|
|
|
@ -4,7 +4,6 @@ SettingsScene.title = "Settings"
|
|||
|
||||
local menu_screens = {
|
||||
InputConfigScene,
|
||||
MenuConfigScene,
|
||||
GameConfigScene,
|
||||
TuningScene
|
||||
}
|
||||
|
@ -58,16 +57,16 @@ function SettingsScene:changeOption(rel)
|
|||
end
|
||||
|
||||
function SettingsScene:onInputPress(e)
|
||||
if e.input == "menu_decide" then
|
||||
if e.input == "menu_decide" or e.scancode == "return" then
|
||||
playSE("main_decide")
|
||||
scene = menu_screens[self.menu_state]()
|
||||
elseif e.input == "menu_up" then
|
||||
elseif e.input == "up" or e.scancode == "up" then
|
||||
self:changeOption(-1)
|
||||
playSE("cursor")
|
||||
elseif e.input == "menu_down" then
|
||||
elseif e.input == "down" or e.scancode == "down" then
|
||||
self:changeOption(1)
|
||||
playSE("cursor")
|
||||
elseif e.input == "menu_back" then
|
||||
elseif e.input == "menu_back" or e.scancode == "backspace" or e.scancode == "delete" then
|
||||
scene = TitleScene()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -86,7 +86,7 @@ function StickConfigScene:onInputPress(e)
|
|||
if not config.input then config.input = {} end
|
||||
config.input.joysticks = self.new_input
|
||||
saveConfig()
|
||||
scene = had_config and InputConfigScene() or MenuConfigScene()
|
||||
scene = had_config and InputConfigScene() or TitleScene()
|
||||
elseif e.scancode == "delete" or e.scancode == "backspace" then
|
||||
-- retry
|
||||
self.input_state = 1
|
||||
|
|
|
@ -114,16 +114,16 @@ function TitleScene:changeOption(rel)
|
|||
end
|
||||
|
||||
function TitleScene:onInputPress(e)
|
||||
if e.input == "menu_decide" then
|
||||
if e.input == "menu_decide" or e.scancode == "return" then
|
||||
playSE("main_decide")
|
||||
scene = main_menu_screens[self.main_menu_state]()
|
||||
elseif e.input == "menu_up" then
|
||||
elseif e.input == "up" or e.scancode == "up" then
|
||||
self:changeOption(-1)
|
||||
playSE("cursor")
|
||||
elseif e.input == "menu_down" then
|
||||
elseif e.input == "down" or e.scancode == "down" then
|
||||
self:changeOption(1)
|
||||
playSE("cursor")
|
||||
elseif e.input == "menu_back" then
|
||||
elseif e.input == "menu_back" or e.scancode == "backspace" or e.scancode == "delete" then
|
||||
love.event.quit()
|
||||
-- no winter easter egg for now
|
||||
--[[
|
||||
|
|
|
@ -63,25 +63,25 @@ function TuningScene:render()
|
|||
end
|
||||
|
||||
function TuningScene:onInputPress(e)
|
||||
if e.input == "menu_decide" then
|
||||
if e.input == "menu_decide" or e.scancode == "return" then
|
||||
playSE("mode_decide")
|
||||
saveConfig()
|
||||
scene = SettingsScene()
|
||||
elseif e.input == "menu_up" then
|
||||
elseif e.input == "up" or e.scancode == "up" then
|
||||
playSE("cursor")
|
||||
self.highlight = Mod1(self.highlight-1, optioncount)
|
||||
elseif e.input == "menu_down" then
|
||||
elseif e.input == "down" or e.scancode == "down" then
|
||||
playSE("cursor")
|
||||
self.highlight = Mod1(self.highlight+1, optioncount)
|
||||
elseif e.input == "menu_left" then
|
||||
elseif e.input == "left" or e.scancode == "left" then
|
||||
playSE("cursor")
|
||||
sld = self[self.options[self.highlight][3]]
|
||||
sld.value = math.max(sld.min, math.min(sld.max, (sld:getValue() - 1) / (sld.max - sld.min)))
|
||||
elseif e.input == "menu_right" then
|
||||
elseif e.input == "right" or e.scancode == "right" then
|
||||
playSE("cursor")
|
||||
sld = self[self.options[self.highlight][3]]
|
||||
sld.value = math.max(sld.min, math.min(sld.max, (sld:getValue() + 1) / (sld.max - sld.min)))
|
||||
elseif e.input == "menu_back" then
|
||||
elseif e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
||||
loadSave()
|
||||
scene = SettingsScene()
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue