|
|
Function
love.mouse.getPosition( )
Gets the current x- and y-position of the mouse in one call. Since getting the mouse position (along both axes) is
a fairly common task, this func was created to make it prettier.
Synopsis
x, y = love.mouse.getPosition( )
Arguments
(None)
Returns
number
The current x position.
number
The current y position.
Examples
Example 2: Getting the mouse position
function load() local f = love.graphics.newFont(love.default_font, 14) love.graphics.setFont(f) end function draw() -- Gets the x- and y-position of the mouse. local x, y = love.mouse.getPosition() -- Draws the position on screen. love.graphics.draw("The mouse is at (" .. x .. "," .. y .. ")", 50, 50) end
Copyright © 2006-2008 LÖVE Development Team.
|