Difference between revisions of "love.touchpressed"

m
 
(2 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
love.touchpressed( id, x, y, pressure )
+
love.touchpressed( id, x, y, dx, dy, pressure )
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|userdata|id|The identifier for the touch press.}}
+
{{param|light userdata|id|The identifier for the touch press.}}
 
{{param|number|x|The x-axis position of the touch press inside the window, in pixels.}}
 
{{param|number|x|The x-axis position of the touch press inside the window, in pixels.}}
 
{{param|number|y|The y-axis position of the touch press inside the window, in pixels.}}
 
{{param|number|y|The y-axis position of the touch press inside the window, in pixels.}}
 +
{{param|number|dx|The x-axis movement of the touch press inside the window, in pixels. This should always be zero.}}
 +
{{param|number|dy|The y-axis movement of the touch press inside the window, in pixels. This should always be zero.}}
 
{{param|number|pressure|The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.}}
 
{{param|number|pressure|The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.}}
 
=== Returns ===
 
=== Returns ===
Line 24: Line 26:
 
[[Category:Callbacks]]
 
[[Category:Callbacks]]
 
{{#set:Description=Callback function triggered when the touch screen is touched.}}
 
{{#set:Description=Callback function triggered when the touch screen is touched.}}
{{#set:Subcategory=General}}
+
{{#set:Subcategory=Touch}}
 
== Other Languages ==
 
== Other Languages ==
 
{{i18n|love.touchpressed}}
 
{{i18n|love.touchpressed}}

Latest revision as of 22:29, 7 March 2019

Available since LÖVE 0.10.0
This function is not supported in earlier versions.

Callback function triggered when the touch screen is touched.

Function

Synopsis

love.touchpressed( id, x, y, dx, dy, pressure )

Arguments

light userdata id
The identifier for the touch press.
number x
The x-axis position of the touch press inside the window, in pixels.
number y
The y-axis position of the touch press inside the window, in pixels.
number dx
The x-axis movement of the touch press inside the window, in pixels. This should always be zero.
number dy
The y-axis movement of the touch press inside the window, in pixels. This should always be zero.
number pressure
The amount of pressure being applied. Most touch screens aren't pressure sensitive, in which case the pressure will be 1.

Returns

Nothing.

Notes

The identifier is only guaranteed to be unique for the specific touch press until love.touchreleased is called with that identifier, at which point it may be reused for new touch presses.

The unofficial Android and iOS ports of LÖVE 0.9.2 reported touch positions as normalized values in the range of [0, 1], whereas this API reports positions in pixels.

See Also


Other Languages