Difference between revisions of "love.mouse.getY"

(Add an example, see also)
 
Line 9: Line 9:
 
=== Returns ===
 
=== Returns ===
 
{{param|number|y|The position of the mouse along the y-axis.}}
 
{{param|number|y|The position of the mouse along the y-axis.}}
 +
== Examples ==
 +
Draw a horizontal [[love.graphics.line|line]] at the mouse's y-position.
 +
<source lang="lua">
 +
function love.draw()
 +
  local y = love.mouse.getY()
 +
  love.graphics.line(0,y, love.graphics.getWidth(),y)
 +
end
 +
</source>
 
== See Also ==
 
== See Also ==
 
* [[parent::love.mouse]]
 
* [[parent::love.mouse]]
 +
* [[love.mouse.getX]]
 +
* [[love.mouse.getPosition]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
{{#set:Description=Returns the current y-position of the mouse.}}
 
{{#set:Description=Returns the current y-position of the mouse.}}

Latest revision as of 13:49, 27 September 2011

Returns the current y-position of the mouse.

Function

Synopsis

y = love.mouse.getY( )

Arguments

None.

Returns

number y
The position of the mouse along the y-axis.

Examples

Draw a horizontal line at the mouse's y-position.

function love.draw()
   local y = love.mouse.getY()
   love.graphics.line(0,y, love.graphics.getWidth(),y)
end

See Also


Other Languages