get mouse coords from touch if possible

akkartik
Dec 26, 2023, 7:32 AM
SHNOGZYZI3NYBOK4KGH7GJELGTOFOMMXXTYEZOLFPBENBE4I23SQC

Dependencies

Change contents

  • replacement in app.lua at line 144
    [3.1763][3.1763:1827]()
    App.mouse_x = love.mouse.getX
    App.mouse_y = love.mouse.getY
    [3.1763]
    [3.1827]
    local solo_touchX = function()
    local touches = love.touch.getTouches()
    if #touches ~= 1 then return end
    local x,y = love.touch.getPosition(touches[1])
    return x
    end
    App.mouse_x = function() return love.mouse.getX() or solo_touchX() end
    local solo_touchY = function()
    local touches = love.touch.getTouches()
    if #touches ~= 1 then return end
    local x,y = love.touch.getPosition(touches[1])
    return y
    end
    App.mouse_y = function() return love.mouse.getY() or solo_touchY() end