Difference between revisions of "love.mouse.getY"

m (1 revision: Importing from potato (again).)
(Add an example, see also)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
 
Returns the current y-position of the mouse.
 
Returns the current y-position of the mouse.
 
== Function ==
 
== Function ==
Line 10: 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.}}
 +
{{#set:Since=000}}
 +
== Other Languages ==
 +
{{i18n|love.mouse.getY}}

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