Assign mouse cursor from image

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
eka
Prole
Posts: 5
Joined: Mon Aug 04, 2014 3:00 pm

Assign mouse cursor from image

Post 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:
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Assign mouse cursor from image

Post 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
User avatar
eka
Prole
Posts: 5
Joined: Mon Aug 04, 2014 3:00 pm

Re: Assign mouse cursor from image

Post by eka »

@slime: Thanks, I was just forgetting to use setCursor :D
Post Reply

Who is online

Users browsing this forum: charryxopow, Google [Bot] and 48 guests