Views
love.mouse.getPosition
Returns the current position of the mouse.
Function
Synopsis
x, y = love.mouse.getPosition( )
Arguments
None.
Returns
number x
- The position of the mouse along the x-axis.
number y
- The position of the mouse along the y-axis.
Examples
Use getPosition to help draw a custom mouse image
function love.load()
love.mouse.setVisible(false) -- make default mouse invisible
img = love.graphics.newImage("mouse.png") -- load in a custom mouse image
end
function love.draw()
local x, y = love.mouse.getPosition() -- get the position of the mouse
love.graphics.draw(img, x, y) -- draw the custom mouse image
end
love.mouse.setVisible(false) -- make default mouse invisible
img = love.graphics.newImage("mouse.png") -- load in a custom mouse image
end
function love.draw()
local x, y = love.mouse.getPosition() -- get the position of the mouse
love.graphics.draw(img, x, y) -- draw the custom mouse image
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info