mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 23:39:02 -06:00
Merge branch 'MillaBasset:master' into master
This commit is contained in:
commit
088439b8a4
@ -1 +1 @@
|
|||||||
version = "v0.3"
|
version = "v0.3.1"
|
@ -13,6 +13,7 @@ GameScene = require "scene.game"
|
|||||||
ModeSelectScene = require "scene.mode_select"
|
ModeSelectScene = require "scene.mode_select"
|
||||||
KeyConfigScene = require "scene.key_config"
|
KeyConfigScene = require "scene.key_config"
|
||||||
StickConfigScene = require "scene.stick_config"
|
StickConfigScene = require "scene.stick_config"
|
||||||
|
MenuConfigScene = require "scene.menu_config"
|
||||||
InputConfigScene = require "scene.input_config"
|
InputConfigScene = require "scene.input_config"
|
||||||
GameConfigScene = require "scene.game_config"
|
GameConfigScene = require "scene.game_config"
|
||||||
TuningScene = require "scene.tuning"
|
TuningScene = require "scene.tuning"
|
||||||
|
@ -80,8 +80,7 @@ function CreditsScene:render()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CreditsScene:onInputPress(e)
|
function CreditsScene:onInputPress(e)
|
||||||
if e.input == "menu_decide" or e.scancode == "return" or
|
if e.input == "menu_decide" or e.input == "menu_back" then
|
||||||
e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
|
||||||
scene = TitleScene()
|
scene = TitleScene()
|
||||||
switchBGM(nil)
|
switchBGM(nil)
|
||||||
end
|
end
|
||||||
|
@ -84,17 +84,17 @@ function ConfigScene:render()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ConfigScene:onInputPress(e)
|
function ConfigScene:onInputPress(e)
|
||||||
if e.input == "menu_decide" or e.scancode == "return" then
|
if e.input == "menu_decide" then
|
||||||
playSE("mode_decide")
|
playSE("mode_decide")
|
||||||
saveConfig()
|
saveConfig()
|
||||||
scene = SettingsScene()
|
scene = SettingsScene()
|
||||||
elseif e.input == "up" or e.scancode == "up" then
|
elseif e.input == "menu_up" then
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
self.highlight = Mod1(self.highlight-1, optioncount)
|
self.highlight = Mod1(self.highlight-1, optioncount)
|
||||||
elseif e.input == "down" or e.scancode == "down" then
|
elseif e.input == "menu_down" then
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
self.highlight = Mod1(self.highlight+1, optioncount)
|
self.highlight = Mod1(self.highlight+1, optioncount)
|
||||||
elseif e.input == "left" or e.scancode == "left" then
|
elseif e.input == "menu_left" then
|
||||||
if not self.options[self.highlight][3] then
|
if not self.options[self.highlight][3] then
|
||||||
playSE("cursor_lr")
|
playSE("cursor_lr")
|
||||||
local option = ConfigScene.options[self.highlight]
|
local option = ConfigScene.options[self.highlight]
|
||||||
@ -105,7 +105,7 @@ function ConfigScene:onInputPress(e)
|
|||||||
sld:update()
|
sld:update()
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
end
|
end
|
||||||
elseif e.input == "right" or e.scancode == "right" then
|
elseif e.input == "menu_right" then
|
||||||
if not self.options[self.highlight][3] then
|
if not self.options[self.highlight][3] then
|
||||||
playSE("cursor_lr")
|
playSE("cursor_lr")
|
||||||
local option = ConfigScene.options[self.highlight]
|
local option = ConfigScene.options[self.highlight]
|
||||||
@ -116,7 +116,7 @@ function ConfigScene:onInputPress(e)
|
|||||||
sld:update()
|
sld:update()
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
end
|
end
|
||||||
elseif e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
elseif e.input == "menu_back" then
|
||||||
loadSave()
|
loadSave()
|
||||||
scene = SettingsScene()
|
scene = SettingsScene()
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local ConfigScene = Scene:extend()
|
local ConfigScene = Scene:extend()
|
||||||
|
|
||||||
ConfigScene.title = "Input Config"
|
ConfigScene.title = "Game Controls"
|
||||||
|
|
||||||
local menu_screens = {
|
local menu_screens = {
|
||||||
KeyConfigScene,
|
KeyConfigScene,
|
||||||
@ -27,7 +27,7 @@ function ConfigScene:render()
|
|||||||
)
|
)
|
||||||
|
|
||||||
love.graphics.setFont(font_3x5_4)
|
love.graphics.setFont(font_3x5_4)
|
||||||
love.graphics.print("INPUT CONFIG", 80, 40)
|
love.graphics.print("IN-GAME CONTROLS", 80, 40)
|
||||||
|
|
||||||
love.graphics.setFont(font_3x5_2)
|
love.graphics.setFont(font_3x5_2)
|
||||||
love.graphics.print("Which controls do you want to configure?", 80, 90)
|
love.graphics.print("Which controls do you want to configure?", 80, 90)
|
||||||
@ -48,18 +48,17 @@ function ConfigScene:changeOption(rel)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ConfigScene:onInputPress(e)
|
function ConfigScene:onInputPress(e)
|
||||||
if e.input == "menu_decide" or e.scancode == "return" then
|
local had_config = config.input ~= nil
|
||||||
|
if e.input == "menu_decide" or (not had_config and e.scancode == "return") then
|
||||||
playSE("main_decide")
|
playSE("main_decide")
|
||||||
scene = menu_screens[self.menu_state]()
|
scene = menu_screens[self.menu_state]()
|
||||||
elseif e.input == "up" or e.scancode == "up" then
|
elseif e.input == "menu_up" or (not had_config and e.scancode == "up") then
|
||||||
self:changeOption(-1)
|
self:changeOption(-1)
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
elseif e.input == "down" or e.scancode == "down" then
|
elseif e.input == "menu_down" or (not had_config and e.scancode == "down") then
|
||||||
self:changeOption(1)
|
self:changeOption(1)
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
elseif config.input and (
|
elseif had_config and e.input == "menu_back" then
|
||||||
e.input == "menu_back" or e.scancode == "backspace" or e.scancode == "delete"
|
|
||||||
) then
|
|
||||||
scene = SettingsScene()
|
scene = SettingsScene()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,8 +5,6 @@ KeyConfigScene.title = "Key Config"
|
|||||||
require 'load.save'
|
require 'load.save'
|
||||||
|
|
||||||
local configurable_inputs = {
|
local configurable_inputs = {
|
||||||
"menu_decide",
|
|
||||||
"menu_back",
|
|
||||||
"left",
|
"left",
|
||||||
"right",
|
"right",
|
||||||
"up",
|
"up",
|
||||||
@ -75,10 +73,15 @@ function KeyConfigScene:onInputPress(e)
|
|||||||
if e.scancode == "return" then
|
if e.scancode == "return" then
|
||||||
-- save new input, then load next scene
|
-- save new input, then load next scene
|
||||||
local had_config = config.input ~= nil
|
local had_config = config.input ~= nil
|
||||||
if not config.input then config.input = {} end
|
if not had_config then
|
||||||
config.input.keys = self.new_input
|
config.input = {}
|
||||||
|
config.input.keys = {}
|
||||||
|
end
|
||||||
|
for k, v in pairs(self.new_input) do
|
||||||
|
config.input.keys[k] = v
|
||||||
|
end
|
||||||
saveConfig()
|
saveConfig()
|
||||||
scene = had_config and InputConfigScene() or TitleScene()
|
scene = had_config and InputConfigScene() or MenuConfigScene()
|
||||||
elseif e.scancode == "delete" or e.scancode == "backspace" then
|
elseif e.scancode == "delete" or e.scancode == "backspace" then
|
||||||
-- retry
|
-- retry
|
||||||
self.input_state = 1
|
self.input_state = 1
|
||||||
|
93
scene/menu_config.lua
Normal file
93
scene/menu_config.lua
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
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
|
if e.y ~= 0 then
|
||||||
self:changeOption(-e.y)
|
self:changeOption(-e.y)
|
||||||
end
|
end
|
||||||
elseif e.input == "menu_decide" or e.scancode == "return" then
|
elseif e.input == "menu_decide" then
|
||||||
current_mode = self.menu_state.mode
|
current_mode = self.menu_state.mode
|
||||||
current_ruleset = self.menu_state.ruleset
|
current_ruleset = self.menu_state.ruleset
|
||||||
config.current_mode = current_mode
|
config.current_mode = current_mode
|
||||||
@ -132,17 +132,17 @@ function ModeSelectScene:onInputPress(e)
|
|||||||
rulesets[self.menu_state.ruleset],
|
rulesets[self.menu_state.ruleset],
|
||||||
self.secret_inputs
|
self.secret_inputs
|
||||||
)
|
)
|
||||||
elseif e.input == "up" or e.scancode == "up" then
|
elseif e.input == "menu_up" then
|
||||||
self:changeOption(-1)
|
self:changeOption(-1)
|
||||||
self.das_up = true
|
self.das_up = true
|
||||||
self.das_down = nil
|
self.das_down = nil
|
||||||
elseif e.input == "down" or e.scancode == "down" then
|
elseif e.input == "menu_down" then
|
||||||
self:changeOption(1)
|
self:changeOption(1)
|
||||||
self.das_down = true
|
self.das_down = true
|
||||||
self.das_up = nil
|
self.das_up = nil
|
||||||
elseif e.input == "left" or e.input == "right" or e.scancode == "left" or e.scancode == "right" then
|
elseif e.input == "menu_left" or e.input == "menu_right" then
|
||||||
self:switchSelect()
|
self:switchSelect()
|
||||||
elseif e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
elseif e.input == "menu_back" then
|
||||||
scene = TitleScene()
|
scene = TitleScene()
|
||||||
elseif e.input then
|
elseif e.input then
|
||||||
self.secret_inputs[e.input] = true
|
self.secret_inputs[e.input] = true
|
||||||
@ -150,9 +150,9 @@ function ModeSelectScene:onInputPress(e)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ModeSelectScene:onInputRelease(e)
|
function ModeSelectScene:onInputRelease(e)
|
||||||
if e.input == "up" or e.scancode == "up" then
|
if e.input == "menu_up" then
|
||||||
self.das_up = nil
|
self.das_up = nil
|
||||||
elseif e.input == "down" or e.scancode == "down" then
|
elseif e.input == "menu_down" then
|
||||||
self.das_down = nil
|
self.das_down = nil
|
||||||
elseif e.input then
|
elseif e.input then
|
||||||
self.secret_inputs[e.input] = false
|
self.secret_inputs[e.input] = false
|
||||||
|
@ -4,6 +4,7 @@ SettingsScene.title = "Settings"
|
|||||||
|
|
||||||
local menu_screens = {
|
local menu_screens = {
|
||||||
InputConfigScene,
|
InputConfigScene,
|
||||||
|
MenuConfigScene,
|
||||||
GameConfigScene,
|
GameConfigScene,
|
||||||
TuningScene
|
TuningScene
|
||||||
}
|
}
|
||||||
@ -57,16 +58,16 @@ function SettingsScene:changeOption(rel)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SettingsScene:onInputPress(e)
|
function SettingsScene:onInputPress(e)
|
||||||
if e.input == "menu_decide" or e.scancode == "return" then
|
if e.input == "menu_decide" then
|
||||||
playSE("main_decide")
|
playSE("main_decide")
|
||||||
scene = menu_screens[self.menu_state]()
|
scene = menu_screens[self.menu_state]()
|
||||||
elseif e.input == "up" or e.scancode == "up" then
|
elseif e.input == "menu_up" then
|
||||||
self:changeOption(-1)
|
self:changeOption(-1)
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
elseif e.input == "down" or e.scancode == "down" then
|
elseif e.input == "menu_down" then
|
||||||
self:changeOption(1)
|
self:changeOption(1)
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
elseif e.input == "menu_back" or e.scancode == "backspace" or e.scancode == "delete" then
|
elseif e.input == "menu_back" then
|
||||||
scene = TitleScene()
|
scene = TitleScene()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -86,7 +86,7 @@ function StickConfigScene:onInputPress(e)
|
|||||||
if not config.input then config.input = {} end
|
if not config.input then config.input = {} end
|
||||||
config.input.joysticks = self.new_input
|
config.input.joysticks = self.new_input
|
||||||
saveConfig()
|
saveConfig()
|
||||||
scene = had_config and InputConfigScene() or TitleScene()
|
scene = had_config and InputConfigScene() or MenuConfigScene()
|
||||||
elseif e.scancode == "delete" or e.scancode == "backspace" then
|
elseif e.scancode == "delete" or e.scancode == "backspace" then
|
||||||
-- retry
|
-- retry
|
||||||
self.input_state = 1
|
self.input_state = 1
|
||||||
|
@ -114,16 +114,16 @@ function TitleScene:changeOption(rel)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function TitleScene:onInputPress(e)
|
function TitleScene:onInputPress(e)
|
||||||
if e.input == "menu_decide" or e.scancode == "return" then
|
if e.input == "menu_decide" then
|
||||||
playSE("main_decide")
|
playSE("main_decide")
|
||||||
scene = main_menu_screens[self.main_menu_state]()
|
scene = main_menu_screens[self.main_menu_state]()
|
||||||
elseif e.input == "up" or e.scancode == "up" then
|
elseif e.input == "menu_up" then
|
||||||
self:changeOption(-1)
|
self:changeOption(-1)
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
elseif e.input == "down" or e.scancode == "down" then
|
elseif e.input == "menu_down" then
|
||||||
self:changeOption(1)
|
self:changeOption(1)
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
elseif e.input == "menu_back" or e.scancode == "backspace" or e.scancode == "delete" then
|
elseif e.input == "menu_back" then
|
||||||
love.event.quit()
|
love.event.quit()
|
||||||
-- no winter easter egg for now
|
-- no winter easter egg for now
|
||||||
--[[
|
--[[
|
||||||
|
@ -63,25 +63,25 @@ function TuningScene:render()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function TuningScene:onInputPress(e)
|
function TuningScene:onInputPress(e)
|
||||||
if e.input == "menu_decide" or e.scancode == "return" then
|
if e.input == "menu_decide" then
|
||||||
playSE("mode_decide")
|
playSE("mode_decide")
|
||||||
saveConfig()
|
saveConfig()
|
||||||
scene = SettingsScene()
|
scene = SettingsScene()
|
||||||
elseif e.input == "up" or e.scancode == "up" then
|
elseif e.input == "menu_up" then
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
self.highlight = Mod1(self.highlight-1, optioncount)
|
self.highlight = Mod1(self.highlight-1, optioncount)
|
||||||
elseif e.input == "down" or e.scancode == "down" then
|
elseif e.input == "menu_down" then
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
self.highlight = Mod1(self.highlight+1, optioncount)
|
self.highlight = Mod1(self.highlight+1, optioncount)
|
||||||
elseif e.input == "left" or e.scancode == "left" then
|
elseif e.input == "menu_left" then
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
sld = self[self.options[self.highlight][3]]
|
sld = self[self.options[self.highlight][3]]
|
||||||
sld.value = math.max(sld.min, math.min(sld.max, (sld:getValue() - 1) / (sld.max - sld.min)))
|
sld.value = math.max(sld.min, math.min(sld.max, (sld:getValue() - 1) / (sld.max - sld.min)))
|
||||||
elseif e.input == "right" or e.scancode == "right" then
|
elseif e.input == "menu_right" then
|
||||||
playSE("cursor")
|
playSE("cursor")
|
||||||
sld = self[self.options[self.highlight][3]]
|
sld = self[self.options[self.highlight][3]]
|
||||||
sld.value = math.max(sld.min, math.min(sld.max, (sld:getValue() + 1) / (sld.max - sld.min)))
|
sld.value = math.max(sld.min, math.min(sld.max, (sld:getValue() + 1) / (sld.max - sld.min)))
|
||||||
elseif e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
elseif e.input == "menu_back" then
|
||||||
loadSave()
|
loadSave()
|
||||||
scene = SettingsScene()
|
scene = SettingsScene()
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user