Files
tromi_mobile/scene/touch_config.lua
Squishy (C6H12O6+NaCl+H2O) bdd0380330 TEST
2024-05-18 16:50:05 +07:00

45 lines
1.3 KiB
Lua

local TouchConfigScene = SCENE:extend()
TouchConfigScene.title = "Touchscreen config\n(you can tap anywhere on touch screen to select this)"
function TouchConfigScene:new()
-- TODO
end
function TouchConfigScene:update()
-- TODO
end
local test_button = BUTTON.new{
name = 'PHÍM THỬ - Chọn widget',
x = 50, y = 50, w = 200, h = 30, textColor = {1,1,1,1},
codeWhenPressed = function() PlaySE("promote") end,
codeWhenReleased = function() PlaySE("lock") end,
}
local function drawButtons()
-- drawText('Select button', 10, 10, 100, 'center')
-- love.graphics.setColor(1,1,1)
-- love.graphics.setLineWidth(3)
-- love.graphics.rectangle('line',0,0,120,40)
test_button:draw()
end
function TouchConfigScene:render()
MainBackground()
drawButtons()
end
function TouchConfigScene:onInputMove(e)
if e.type == "mouse" then
test_button:isHovering(e.x, e.y)
end
end
function TouchConfigScene:onInputPress(e)
if e.input == 'menu_back' then SCENE = InputConfigScene() end
if e.type == 'mouse' then test_button:press() end
if e.type == 'touch' then test_button:press(true) end
end
function TouchConfigScene:onInputRelease(e)
if e.type == 'mouse' then test_button:press() end
end
return TouchConfigScene