mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Update both key and stick configuration scenes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
local StickConfigScene = SCENE:extend()
|
||||
StickConfigScene.title = "Controller Config"
|
||||
local buttonList1 = {}
|
||||
local buttonList = {}
|
||||
|
||||
local configurable_inputs = {
|
||||
"menu_decide",
|
||||
@@ -41,8 +41,8 @@ function StickConfigScene:new()
|
||||
self.new_input = {}
|
||||
self.axis_timer = 0
|
||||
|
||||
BUTTON.reset(buttonList1)
|
||||
buttonList1 = { -- Configuring
|
||||
BUTTON.reset(buttonList)
|
||||
buttonList = { -- Configuring
|
||||
BUTTON.new{
|
||||
text = CHAR.key.tab.."\nTab",
|
||||
x = 40, y = 300, w = 100, h = 50,
|
||||
@@ -71,7 +71,7 @@ end
|
||||
|
||||
function StickConfigScene:render()
|
||||
MainBackground()
|
||||
BUTTON.draw(buttonList1)
|
||||
BUTTON.draw(buttonList)
|
||||
|
||||
for i, input in ipairs(configurable_inputs) do
|
||||
drawText(input_names[input], 40, 60 + i * 20, 200, "left")
|
||||
@@ -80,7 +80,7 @@ function StickConfigScene:render()
|
||||
end
|
||||
end
|
||||
if self.input_state > #configurable_inputs then
|
||||
drawText("Press enter/Confirm Selection to confirm, delete/backspace to retry" .. (SETTINGS.input.joysticks and ", esc/Go Back to cancel" or ""), 0, 0, 1000)
|
||||
drawText("Press Enter/Confirm Selection to confirm, Delete/Backspace to retry" .. (SETTINGS.input.joysticks and ", Esc/Go Back to cancel" or ""), 0, 0, 1000)
|
||||
else
|
||||
drawText("Press joystick input for " .. input_names[configurable_inputs[self.input_state]] .. ", tab to skip, escape to cancel", 0, 0, 1000)
|
||||
end
|
||||
@@ -94,10 +94,9 @@ local function addJoystick(input, name)
|
||||
end
|
||||
end
|
||||
|
||||
---@param e SCENE_onInput
|
||||
function StickConfigScene:onInputPress(e)
|
||||
if e.type == "mouse" or e.type == "touch" then
|
||||
BUTTON.press(buttonList1, e.x, e.y, e.id)
|
||||
BUTTON.press(buttonList, e.x, e.y, e.id)
|
||||
elseif e.type == "key" then
|
||||
-- function keys, escape, and tab are reserved and can't be remapped
|
||||
if e.scancode == "escape" or (self.input_state > #configurable_inputs and e.input == "menu_back") then
|
||||
@@ -175,13 +174,13 @@ end
|
||||
|
||||
function StickConfigScene:onInputRelease(e)
|
||||
if e.type == "mouse" or e.type == "touch" then
|
||||
BUTTON.release(buttonList1, e.x, e.y, e.id)
|
||||
BUTTON.release(buttonList, e.x, e.y, e.id)
|
||||
end
|
||||
end
|
||||
|
||||
function StickConfigScene:onInputMove(e)
|
||||
if e.type == "mouse" then
|
||||
BUTTON.checkHovering(buttonList1, e.x, e.y)
|
||||
BUTTON.checkHovering(buttonList, e.x, e.y)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user