Page 1 of 1

Assign mouse cursor from image

Posted: Wed Aug 06, 2014 3:26 am
by eka
Hi all, new to Love2d

I tried to set a mouse cursor with love.mouse.newCursor('miImage.png', x, y) in the load callback, but that doesn't work.

What is the proper way to set the mouse cursor without having to rely on code to paint an image that follows the mouse (overkill)

Thanks!

:nyu:

Re: Assign mouse cursor from image

Posted: Wed Aug 06, 2014 4:33 am
by slime
That should work - make sure to call love.mouse.setCursor after creating the cursor.

Something like this:

Code: Select all

function love.load()
    local hot_x, hot_y = 0, 0
    mycursor = love.mouse.newCursor("miImage.png", hot_x, hot_y)
    love.mouse.setCursor(mycursor)
end

Re: Assign mouse cursor from image

Posted: Wed Aug 06, 2014 10:28 am
by eka
@slime: Thanks, I was just forgetting to use setCursor :D