mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Update
This commit is contained in:
@@ -7,7 +7,7 @@ TouchConfigScene.title = "Touchscreen config\n(you can tap anywhere on touch scr
|
||||
2. Add behaviors
|
||||
]]
|
||||
|
||||
local widgetList = {
|
||||
local buttonList = {
|
||||
select_widget = BUTTON.new{
|
||||
text = "Select key\n[Rotate right 2]",
|
||||
x = 10, y = 10, w = 120, h = 110
|
||||
@@ -33,6 +33,7 @@ local widgetList = {
|
||||
BUTTON.new{
|
||||
text = "Opacity: 50%\nTap to reset",
|
||||
x = 255, y = 70, w = 100, h = 50,
|
||||
codeWhenReleased = function() PlaySE("autopromote") end
|
||||
},
|
||||
BUTTON.new{
|
||||
text = "[+]\nTotally see",
|
||||
@@ -52,23 +53,7 @@ local widgetList = {
|
||||
text = "RESET to\nDEFAULT",
|
||||
x = 560, y = 70, w = 70, h = 50,
|
||||
},
|
||||
|
||||
}
|
||||
local function widgetList_update()
|
||||
for _, v in pairs(widgetList) do v:update() end
|
||||
end
|
||||
local function widgetList_draw()
|
||||
for _, v in pairs(widgetList) do v:draw() end
|
||||
end
|
||||
local function widgetList_isHovering(x, y)
|
||||
for _, v in pairs(widgetList) do v:isHovering(x, y) end
|
||||
end
|
||||
local function widgetList_press()
|
||||
for _, v in pairs(widgetList) do v:press() end
|
||||
end
|
||||
local function widgetList_release()
|
||||
for _, v in pairs(widgetList) do v:release() end
|
||||
end
|
||||
|
||||
function TouchConfigScene:new()
|
||||
-- TODO
|
||||
@@ -79,31 +64,28 @@ end
|
||||
|
||||
function TouchConfigScene:render()
|
||||
MainBackground()
|
||||
widgetList_draw()
|
||||
BUTTON.draw(buttonList)
|
||||
end
|
||||
|
||||
---@param e SCENE_onInput
|
||||
function TouchConfigScene:onInputMove(e)
|
||||
if e.type == "mouse" then
|
||||
widgetList_isHovering(e.x, e.y)
|
||||
BUTTON.checkHovering(buttonList, e.x, e.y)
|
||||
end
|
||||
end
|
||||
---@param e SCENE_onInput
|
||||
function TouchConfigScene:onInputPress(e)
|
||||
if e.input == 'menu_back' then SCENE = InputConfigScene() end
|
||||
if e.type == "mouse" then widgetList_press() end
|
||||
if e.type == "touch" then
|
||||
widgetList_isHovering(e.x,e.y)
|
||||
widgetList_press()
|
||||
if e.type == "mouse" or e.type == "touch" then
|
||||
BUTTON.press(buttonList, e.x, e.y)
|
||||
end
|
||||
end
|
||||
---@param e SCENE_onInput
|
||||
function TouchConfigScene:onInputRelease(e)
|
||||
if e.type == "mouse" then
|
||||
widgetList_release()
|
||||
widgetList_isHovering(x, y)
|
||||
BUTTON.release(buttonList, e.x, e.y)
|
||||
elseif e.type == "touch" then
|
||||
widgetList_release()
|
||||
BUTTON.release(buttonList, e.x, e.y, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user