Page 1 of 1

I want to make a custom mouse

Posted: Sat Jul 06, 2013 2:46 am
by XxFullMetalxX
I want to make a custom mouse but The Image is black!

please help!

Re: I want to make a custom mouse

Posted: Sat Jul 06, 2013 8:29 am
by mickeyjm
We need a little more information than that.
Can you provide us with a .love or at least a code snippet?

Re: I want to make a custom mouse

Posted: Sat Jul 06, 2013 1:05 pm
by Eamonn
I know how to fix it I think.

I assume you have the image that you want, correct? And you've hidden your mouse cursor, correct? Here are the steps:

1) Get your image.
2) Do the following code:

Code: Select all

function love.load()
    love.mouse.setVisible(false)
    mouseImage = love.graphics.newImage("imageName")
end

function love.update(dt)
    mouseX, mouseY = love.mouse.getPosition() -- If it doesn't work here move it to the bottom after you update everything.
    
    -- Other game generating stuff
end

function love.draw()
    -- Other code stuff. THIS NEEDS TO BE AT THE BOTTOM!!
    love.graphics.setColor(255,255,255,0) -- The extra 0 makes sure it's fully visible, but it's not needed
    love.graphics.draw( mouseImage, mouseX, mouseY )
end
This should fix it. Hope it helped!! :D :D :D

EDIT: Maybe consider putting these types of questions in the "Support and Development" section. :)

Re: I want to make a custom mouse

Posted: Sat Jul 06, 2013 1:16 pm
by mickeyjm
Eamonn wrote:

Code: Select all

    love.graphics.setColor(255,255,255,0) -- The extra 0 makes sure it's fully visible, but it's not needed
Setting the alpha to 0 will actuallt make the image fully invisible. You should just remove that argument as it will default to 255 which is full opacity.

Re: I want to make a custom mouse

Posted: Sat Jul 06, 2013 1:19 pm
by Eamonn
mickeyjm wrote:
Eamonn wrote:

Code: Select all

    love.graphics.setColor(255,255,255,0) -- The extra 0 makes sure it's fully visible, but it's not needed
Setting the alpha to 0 will actuallt make the image fully invisible. You should just remove that argument as it will default to 255 which is full opacity.
Oh, thanks! I thought it was the other way around. I never work with Alpha(except in MBG2, that was a heck of a time with the fade in's and outs.) I did that incase he changes it later it's still visible.