Difference between revisions of "love.mousereleased"

(Added missing "presses" param and new varient of function)
m (Second variant was removed in 11.0)
Line 3: Line 3:
  
 
== Function ==
 
== Function ==
{{newin|[[0.11.0]]|100|type=variant}}
+
{{newin|[[11.0]]|110|type=variant}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Line 19: Line 19:
  
 
== Function ==
 
== Function ==
{{newin|[[0.10.0]]|100|type=variant}}
+
{{newinoldin|[[0.10.0]]|100|[[11.0]]|110|type=variant}}
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">

Revision as of 07:05, 7 August 2018

Callback function triggered when a mouse button is released.


Function

Available since LÖVE 11.0
This variant is not supported in earlier versions.

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.
number presses
The number of presses in a short time frame and small area, used to simulate double, triple clicks

Returns

Nothing.

Function

Available since LÖVE 0.10.0 and removed in LÖVE 11.0
This variant is not supported in earlier or later versions.

Synopsis

love.mousereleased( x, y, button, istouch )

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.

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