Do some preparation for touch config screen

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-04-21 18:21:52 +07:00
parent 50fdcae8ac
commit 9425b047e2
5 changed files with 107 additions and 65 deletions

View File

@@ -28,11 +28,11 @@ function ConfigScene:render()
end
love.graphics.setColor(1, 1, 1, 0.5)
love.graphics.rectangle("fill", 75, 118 + 50 * self.menu_state, 300, 35)
love.graphics.rectangle("fill", 75, 118 + 50 * self.menu_state, 400, 35)
love.graphics.setColor(1, 1, 1, 1)
for i, screen in pairs(menu_screens) do
drawText(screen.title, 80, 120 + 50 * i, 300, "left")
drawText(screen.title, 80, 120 + 50 * i, 400, "left")
end
end

View File

@@ -1,21 +1,38 @@
local TouchConfigScene = SCENE:extend()
TouchConfigScene.title = "Touchscreen config\n(you can tap anywhere to select this)"
TouchConfigScene.title = "Touchscreen config\n(you can tap anywhere on touch screen to select this)"
local origin_touchPressed, origin_touchReleased, origin_touchMoved
local function onPressed(id, x, y)
if not VCTRL.press(x, y, id) then
-- TODO
end
end
local function onMoved(id, _, _, dx, dy)
VCTRL.drag(dx, dy, id)
end
local function onReleased(id)
if not VCTRL.release(id) then
-- TODO
end
end
function TouchConfigScene:new()
-- TODO
-- Temproraily hijacking game's touch-related functions
origin_touchPressed, origin_touchReleased, origin_touchMoved = love.touchpressed, love.touchreleased, love.touchmoved
SETTINGS.input.keys = table.merge(SETTINGS.input.keys, SETTINGS.input.touch)
end
function TouchConfigScene:update()
-- TODO
end
function TouchConfigScene:onInputPress(e)
end
function TouchConfigScene:onInputRelease(e)
end
function TouchConfigScene:render()
MainBackground()
end
function TouchConfigScene:onQuit()
love.touchpressed, love.touchreleased, love.touchmoved = origin_touchPressed, origin_touchReleased, origin_touchMoved
end
return TouchConfigScene