diff --git a/load/version.lua b/load/version.lua index 0328391..0f04b6a 100644 --- a/load/version.lua +++ b/load/version.lua @@ -1 +1 @@ -version = "v0.3.1" \ No newline at end of file +version = "v0.3" \ No newline at end of file diff --git a/scene.lua b/scene.lua index 2839dc5..aaa81b8 100644 --- a/scene.lua +++ b/scene.lua @@ -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" diff --git a/scene/credits.lua b/scene/credits.lua index be92055..c3ecbe7 100644 --- a/scene/credits.lua +++ b/scene/credits.lua @@ -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 diff --git a/scene/game_config.lua b/scene/game_config.lua index c958676..c71aa17 100644 --- a/scene/game_config.lua +++ b/scene/game_config.lua @@ -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 diff --git a/scene/input_config.lua b/scene/input_config.lua index 3e34bb3..7b488f8 100644 --- a/scene/input_config.lua +++ b/scene/input_config.lua @@ -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 diff --git a/scene/key_config.lua b/scene/key_config.lua index 0d398b0..419ebb5 100644 --- a/scene/key_config.lua +++ b/scene/key_config.lua @@ -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 diff --git a/scene/menu_config.lua b/scene/menu_config.lua deleted file mode 100644 index b0d2bd0..0000000 --- a/scene/menu_config.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/scene/mode_select.lua b/scene/mode_select.lua index 4ec3eee..d35594c 100755 --- a/scene/mode_select.lua +++ b/scene/mode_select.lua @@ -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 diff --git a/scene/settings.lua b/scene/settings.lua index 3478887..c9663aa 100644 --- a/scene/settings.lua +++ b/scene/settings.lua @@ -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 diff --git a/scene/stick_config.lua b/scene/stick_config.lua index 6c435ba..3e7be01 100644 --- a/scene/stick_config.lua +++ b/scene/stick_config.lua @@ -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 diff --git a/scene/title.lua b/scene/title.lua index 437d5bb..cddb8df 100644 --- a/scene/title.lua +++ b/scene/title.lua @@ -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 --[[ diff --git a/scene/tuning.lua b/scene/tuning.lua index efa546b..ef0f4ee 100644 --- a/scene/tuning.lua +++ b/scene/tuning.lua @@ -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