Difference between revisions of "love.mousereleased"

(Add an example)
Line 11: Line 11:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
== Examples ==
 +
Position a string ("Text") wherever the user releases the left 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 == "l" then
 +
      printx = x
 +
      printy = y
 +
  end
 +
end
 +
</source>
 
== See Also ==
 
== See Also ==
 
* [[parent::love]]
 
* [[parent::love]]

Revision as of 21:16, 26 September 2011

Callback function triggered when a mouse button is released.

Function

Synopsis

love.mousereleased( x, y, button )

Arguments

number x
Mouse x position.
number y
Mouse y position.
MouseConstant button
Mouse button released.

Returns

Nothing.

Examples

Position a string ("Text") wherever the user releases the left 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 == "l" then
      printx = x
      printy = y
   end
end

See Also


Other Languages