Files
tromi_mobile/scene/touch_config.lua
Squishy (C6H12O6+NaCl+H2O) d7cc69b2fe TEST
2024-05-22 00:27:11 +07:00

91 lines
2.3 KiB
Lua

local TouchConfigScene = SCENE:extend()
TouchConfigScene.title = "Touchscreen config\n(you can tap anywhere on touch screen to select this)"
--[[
TODO:
1. Can import and export data
2. Add behaviors
]]
local buttonList = {
select_button = BUTTON.new{
text = "Select key\n[Rotate right 2]",
x = 10, y = 10, w = 120, h = 110
},
zoom_negat = BUTTON.new{
text = "[—]\nSmaller",
x = 145, y = 10, w = 100, h = 50,
},
zoom_reset = BUTTON.new{
text = "Size: 50\nTap to reset",
x = 255, y = 10, w = 100, h = 50,
},
zoom_posit = BUTTON.new{
text = "[+]\nBigger",
x = 365, y = 10, w = 100, h = 50,
},
opact_negat = BUTTON.new{
text = "[—]\nCan't see",
x = 145, y = 70, w = 100, h = 50,
},
opact_reset = BUTTON.new{
text = "Opacity: 50%\nTap to reset",
x = 255, y = 70, w = 100, h = 50,
codeWhenReleased = function() PlaySE("autopromote") end
},
opact_posit = BUTTON.new{
text = "[+]\nTotally see",
x = 365, y = 70, w = 100, h = 50,
},
menu_back = BUTTON.new{
text = "SAVE and\nback to MENU",
x = 480, y = 10, w = 150, h = 50,
codeWhenReleased = function() SCENE = TitleScene() end
},
BUTTON.new{
text = "DISCARD\nchanges",
x = 480, y = 70, w = 70, h = 50,
},
BUTTON.new{
text = "RESET to\nDEFAULT",
x = 560, y = 70, w = 70, h = 50,
},
}
function TouchConfigScene:new()
-- TODO
end
function TouchConfigScene:update()
-- TODO
end
function TouchConfigScene:render()
MainBackground()
BUTTON.draw(buttonList)
drawBigText(buttonList.opact_reset._pressed and "okay" or "not", 400, 400, 100, "left")
end
---@param e SCENE_onInput
function TouchConfigScene:onInputMove(e)
if e.type == "mouse" then
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" 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" or e.type == "touch" then
BUTTON.release(buttonList, e.x, e.y)
end
end
return TouchConfigScene