Callback function triggered when a mouse button is pressed.
== Function ==
=== Synopsis ===
<source lang="lua">
love.mousepressed( 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 pressed. 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 press originated from a touchscreen touch-press.}}
{{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.
=== Notes ===
Use [[love.wheelmoved]] to detect mouse wheel motion. It will not register as a button press in version [[0.10.0]] and newer.

== Function ==
{{oldin|[[0.10.0]]|100|type=variant}}
=== Synopsis ===
<source lang="lua">
love.mousepressed( x, y, button )
</source>
=== Arguments ===
{{param|number|x|Mouse x position.}}
{{param|number|y|Mouse y position.}}
{{param|MouseConstant|button|Mouse button pressed.}}
=== Returns ===
Nothing.
== Examples ==
Position a string ("Text") wherever the user left-clicks.
<source lang="lua">
function love.load()
   printx = 0
   printy = 0
end

function love.draw()
   love.graphics.print("Text", printx, printy)
end

function love.mousepressed(x, y, button, istouch)
   if button == 1 then -- Versions prior to 0.10.0 use the MouseConstant 'l'
      printx = x
      printy = y
   end
end
</source>

== See Also ==
* [[parent::love]]
* [[love.mousereleased]]
* [[love.mouse.isDown]]
[[Category:Callbacks]]
{{#set:Description=Callback function triggered when a mouse button is pressed.}}
{{#set:Subcategory=Mouse}}
{{#set:Since=000}}
== Other Languages ==
{{i18n|love.mousepressed}}