This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-21 23:29:11 +07:00
parent 0aab8c8d74
commit 64336f7cbc
2 changed files with 6 additions and 8 deletions

View File

@@ -237,18 +237,16 @@ end
---@param list table<BUTTON.button> ---@param list table<BUTTON.button>
---@param x number # Mouse position ---@param x number # Mouse position
---@param y number # Mouse position ---@param y number # Mouse position
---@param isMouse? boolean # Is mouse just released a button? function BUTTON.press(list, x, y)
function BUTTON.press(list, x, y, isMouse) for _, v in pairs(list) do v:press(x, y) end
for _, v in pairs(list) do v:press(x, y, isMouse) end
end end
---Trigger the release action ---Trigger the release action
---@param list table<BUTTON.button> ---@param list table<BUTTON.button>
---@param x number # Mouse position ---@param x number # Mouse position
---@param y number # Mouse position ---@param y number # Mouse position
---@param isMouse? boolean # Is mouse just released a button? function BUTTON.release(list, x, y)
function BUTTON.release(list, x, y, isMouse) for _, v in pairs(list) do v:release(x, y) end
for _, v in pairs(list) do v:release(x, y, isMouse) end
end end
return BUTTON return BUTTON

View File

@@ -77,13 +77,13 @@ end
function TouchConfigScene:onInputPress(e) function TouchConfigScene:onInputPress(e)
if e.input == 'menu_back' then SCENE = InputConfigScene() end if e.input == 'menu_back' then SCENE = InputConfigScene() end
if e.type == "mouse" or e.type == "touch" then if e.type == "mouse" or e.type == "touch" then
BUTTON.press(buttonList, e.x, e.y, e.type == "touch") BUTTON.press(buttonList, e.x, e.y)
end end
end end
---@param e SCENE_onInput ---@param e SCENE_onInput
function TouchConfigScene:onInputRelease(e) function TouchConfigScene:onInputRelease(e)
if e.type == "mouse" or e.type == "touch" then if e.type == "mouse" or e.type == "touch" then
BUTTON.release(buttonList, e.x, e.y, e.type == "touch") BUTTON.release(buttonList, e.x, e.y)
end end
end end