Difference between revisions of "love.mousereleased"
(→See Also) |
|||
(18 intermediate revisions by 13 users not shown) | |||
Line 1: | Line 1: | ||
+ | Callback function triggered when a mouse button is released. | ||
+ | == Function == | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | love.mousereleased( x, y, button, istouch, presses ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|number|x|Mouse x position, in pixels.}} | ||
+ | {{param|number|y|Mouse y position, in pixels.}} | ||
+ | {{param|number|button|The button index that was released. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent.}} | ||
+ | {{param|boolean|istouch|True if the mouse button release originated from a touchscreen touch-release.}} | ||
+ | {{New feature|11.0| | ||
+ | {{param|number|presses|The number of presses in a short time frame and small area, used to simulate double, triple clicks}} | ||
+ | |110}} | ||
+ | === Returns === | ||
+ | Nothing. | ||
== Function == | == Function == | ||
+ | {{oldin|[[0.10.0]]|100|type=variant}} | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
Line 9: | Line 26: | ||
{{param|number|x|Mouse x position.}} | {{param|number|x|Mouse x position.}} | ||
{{param|number|y|Mouse y position.}} | {{param|number|y|Mouse y position.}} | ||
− | {{param|MouseConstant|button|Mouse button released.}} | + | {{param|MouseConstant|button|Mouse button released, except Mouse Wheel.}} |
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | |||
+ | == Examples == | ||
+ | Position a string ("Text") wherever the user releases the primary mouse button. | ||
+ | <source lang="lua"> | ||
+ | function love.load() | ||
+ | printx = 0 | ||
+ | printy = 0 | ||
+ | end | ||
+ | |||
+ | function love.draw() | ||
+ | love.graphics.print("Text", printx, printy) | ||
+ | end | ||
+ | |||
+ | function love.mousereleased(x, y, button) | ||
+ | if button == 1 then | ||
+ | printx = x | ||
+ | printy = y | ||
+ | end | ||
+ | end | ||
+ | </source> | ||
+ | |||
== See Also == | == See Also == | ||
* [[parent::love]] | * [[parent::love]] | ||
+ | * [[love.mouse]] | ||
+ | * [[love.mousepressed]] | ||
+ | * [[love.mousemoved]] | ||
+ | |||
+ | |||
[[Category:Callbacks]] | [[Category:Callbacks]] | ||
− | {{#set:Description=}} | + | {{#set:Description=Callback function triggered when a mouse button is released.}} |
+ | {{#set:Subcategory=Mouse}} | ||
+ | {{#set:Since=000}} | ||
+ | |||
+ | == Other Languages == | ||
+ | {{i18n|love.mousereleased}} |
Latest revision as of 07:48, 8 March 2023
Callback function triggered when a mouse button is released.
Contents
Function
Synopsis
love.mousereleased( x, y, button, istouch, presses )
Arguments
number x
- Mouse x position, in pixels.
number y
- Mouse y position, in pixels.
number button
- The button index that was released. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent.
boolean istouch
- True if the mouse button release originated from a touchscreen touch-release.
Available since LÖVE 11.0
number presses
- The number of presses in a short time frame and small area, used to simulate double, triple clicks
Returns
Nothing.
Function
Removed in LÖVE 0.10.0 |
This variant is not supported in that and later versions. |
Synopsis
love.mousereleased( x, y, button )
Arguments
number x
- Mouse x position.
number y
- Mouse y position.
MouseConstant button
- Mouse button released, except Mouse Wheel.
Returns
Nothing.
Examples
Position a string ("Text") wherever the user releases the primary mouse button.
function love.load()
printx = 0
printy = 0
end
function love.draw()
love.graphics.print("Text", printx, printy)
end
function love.mousereleased(x, y, button)
if button == 1 then
printx = x
printy = y
end
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info