mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
TEST
This commit is contained in:
@@ -235,15 +235,16 @@ end
|
||||
---@param x number # Mouse position
|
||||
---@param y number # Mouse position
|
||||
function BUTTON.checkHovering(list, x, y)
|
||||
for _, v in pairs(list) do v:isHovering(x, y) end
|
||||
for _, v in pairs(list) do v._hovering = v:isHovering(x, y) end
|
||||
end
|
||||
|
||||
--- Trigger the press action, only if ``button._hovering == true``
|
||||
---@param list table<BUTTON.button>
|
||||
---@param x number # Mouse position
|
||||
---@param y number # Mouse position
|
||||
function BUTTON.press(list, x, y)
|
||||
for _, v in pairs(list) do v:press(x, y) end
|
||||
---@param isMouse? boolean # Is mouse just released a button?
|
||||
function BUTTON.press(list, x, y, isMouse)
|
||||
for _, v in pairs(list) do v:press(x, y, isMouse) end
|
||||
end
|
||||
|
||||
---Trigger the release action
|
||||
|
||||
@@ -129,7 +129,7 @@ end
|
||||
|
||||
function NameEntryScene:onInputPress(e)
|
||||
if e.type == "mouse" or e.type == "touch" then
|
||||
BUTTON.press(buttonList, e.x, e.y)
|
||||
BUTTON.press(buttonList, e.x, e.y, e.type == "touch")
|
||||
elseif e.input == "menu_decide" or e.input == "rotate_left" or e.scancode == "return" then
|
||||
self.delete_confirm = false
|
||||
self.delete_input_count = 0
|
||||
@@ -198,10 +198,8 @@ function NameEntryScene:onInputPress(e)
|
||||
end
|
||||
|
||||
function NameEntryScene:onInputRelease(e)
|
||||
if e.type == "mouse" then
|
||||
BUTTON.release(buttonList, e.x, e.y)
|
||||
elseif e.type == "touch" then
|
||||
BUTTON.release(buttonList, e.x, e.y, true)
|
||||
if e.type == "mouse" or e.type == "touch" then
|
||||
BUTTON.release(buttonList, e.x, e.y, e.type == "touch")
|
||||
elseif e.input == "left" or e.scancode == "left" or e.input == "right" or e.scancode == "right" then
|
||||
self.direction = nil
|
||||
self.repeat_counter = self.repeat_limit-1
|
||||
|
||||
@@ -77,15 +77,13 @@ end
|
||||
function TouchConfigScene:onInputPress(e)
|
||||
if e.input == 'menu_back' then SCENE = InputConfigScene() end
|
||||
if e.type == "mouse" or e.type == "touch" then
|
||||
BUTTON.press(buttonList, e.x, e.y)
|
||||
BUTTON.press(buttonList, e.x, e.y, e.type == "touch")
|
||||
end
|
||||
end
|
||||
---@param e SCENE_onInput
|
||||
function TouchConfigScene:onInputRelease(e)
|
||||
if e.type == "mouse" then
|
||||
BUTTON.release(buttonList, e.x, e.y, true)
|
||||
elseif e.type == "touch" then
|
||||
BUTTON.release(buttonList, e.x, e.y)
|
||||
if e.type == "mouse" or e.type == "touch" then
|
||||
BUTTON.release(buttonList, e.x, e.y, e.type == "touch")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user