Available since LÖVE 0.10.0
This function is not supported in earlier versions.
Gets the current position of the specified touch-press, in pixels.
x, y = love.touch.getPosition( id )
light userdata idnumber xnumber yThe unofficial Android and iOS ports of LÖVE 0.9.2 reported touch-press positions as normalized values in the range of [0, 1], whereas this API reports positions in pixels.
function love.draw()
local touches = love.touch.getTouches()
for i, id in ipairs(touches) do
local x, y = love.touch.getPosition(id)
love.graphics.circle("fill", x, y, 20)
end
end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.touch.getPosition