Example
Getting the x- and y-position of the mouse
Example 0003: Getting the x- and y-position of the mouse
  1. -- Example: Getting the x- and y-position of the mouse 
  2.  
  3. function load() 
  4.     local f = love.graphics.newFont(love.default_font, 14
  5.     love.graphics.setFont(f) 
  6. end 
  7.  
  8. function draw() 
  9.     -- Gets the x- and y-position of the mouse. 
  10.     local x = love.mouse.getX() 
  11.     local y = love.mouse.getY() 
  12.     -- Draws the position on screen. 
  13.     love.graphics.draw("The mouse is at (" .. x .. "," .. y .. ")"5050
  14. end 
Copyright © 2006-2008 LÖVE Development Team.