mirror of
https://github.com/love2d/love.git
synced 2026-08-14 01:20:56 +02:00
Added love.touch module and touch screen events. Resolves issue #825.
Note: this implementation is slightly different from the implementation in the love 0.9.x Android and iOS ports! Added love.touchpressed(id, x, y), love.touchmoved(id, x, y, dx, dy), and love.touchreleased(id, x, y, dx, dy). id is a unique identifier for the touch press that persists until love.touchreleased. After that it is no longer unique. x and y are the coordinates of the touch event in pixels within the window. dx and dy are the amount in pixels that the touch has moved since the last event. Added love.touch.getTouchCount and love.touch.getTouch(index). love.touch.getTouch takes an index (not the same as an id. indices are not stable and don't correspond to a unique touch press.) It returns the id of the touch and its current x and y coordinates in pixels. --HG-- branch : minor
This commit is contained in:
@@ -178,6 +178,15 @@ function love.createhandlers()
|
||||
wheelmoved = function (x,y)
|
||||
if love.wheelmoved then return love.wheelmoved(x,y) end
|
||||
end,
|
||||
touchpressed = function (id,x,y,dx,dy)
|
||||
if love.touchpressed then return love.touchpressed(id,x,y,dx,dy) end
|
||||
end,
|
||||
touchreleased = function (id,x,y,dx,dy)
|
||||
if love.touchreleased then return love.touchreleased(id,x,y,dx,dy) end
|
||||
end,
|
||||
touchmoved = function (id,x,y,dx,dy)
|
||||
if love.touchmoved then return love.touchmoved(id,x,y,dx,dy) end
|
||||
end,
|
||||
joystickpressed = function (j,b)
|
||||
if love.joystickpressed then return love.joystickpressed(j,b) end
|
||||
end,
|
||||
@@ -333,6 +342,7 @@ function love.init()
|
||||
mouse = true,
|
||||
timer = true,
|
||||
joystick = true,
|
||||
touch = true,
|
||||
image = true,
|
||||
graphics = true,
|
||||
audio = true,
|
||||
@@ -383,6 +393,7 @@ function love.init()
|
||||
"keyboard",
|
||||
"joystick",
|
||||
"mouse",
|
||||
"touch",
|
||||
"sound",
|
||||
"system",
|
||||
"audio",
|
||||
|
||||
Reference in New Issue
Block a user