Skip to content

Commit e861f72

Browse files
committed
Add touchmoved, touchpressed and touchreleased callbacks
1 parent 6204aec commit e861f72

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

Screen.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ function Screen.new()
6767

6868
function self:quit(dquit) end
6969

70+
function self:touchmoved(id, x, y, pressure) end
71+
72+
function self:touchpressed(id, x, y, pressure) end
73+
74+
function self:touchreleased(id, x, y, pressure) end
75+
7076
function self:wheelmoved(x, y) end
7177

7278
function self:isActive()

ScreenManager.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,39 @@ function ScreenManager.quit(dquit)
260260
ScreenManager.peek():quit(dquit);
261261
end
262262

263+
---
264+
-- Callback function triggered when a touch press moves inside the touch screen.
265+
-- @param id - The identifier for the touch press.
266+
-- @param x - The x-axis position of the touch press inside the window, in pixels.
267+
-- @param y - The y-axis position of the touch press inside the window, in pixels.
268+
-- @param pressure - The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.
269+
--
270+
function ScreenManager.touchmoved(id, x, y, pressure)
271+
ScreenManager.peek():touchmoved(id, x, y, pressure);
272+
end
273+
274+
---
275+
-- Callback function triggered when the touch screen is touched.
276+
-- @param id - The identifier for the touch press.
277+
-- @param x - The x-axis position of the touch press inside the window, in pixels.
278+
-- @param y - The y-axis position of the touch press inside the window, in pixels.
279+
-- @param pressure - The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.
280+
--
281+
function ScreenManager.touchpressed(id, x, y, pressure)
282+
ScreenManager.peek():touchpressed(id, x, y, pressure);
283+
end
284+
285+
---
286+
-- Callback function triggered when the touch screen stops being touched.
287+
-- @param id - The identifier for the touch press.
288+
-- @param x - The x-axis position of the touch press inside the window, in pixels.
289+
-- @param y - The y-axis position of the touch press inside the window, in pixels.
290+
-- @param pressure - The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.
291+
--
292+
function ScreenManager.touchreleased(id, x, y, pressure)
293+
ScreenManager.peek():touchreleased(id, x, y, pressure);
294+
end
295+
263296
---
264297
-- Callback function triggered when the mouse wheel is moved.
265298
-- @param x - Amount of horizontal mouse wheel movement. Positive values indicate movement to the right.

0 commit comments

Comments
 (0)