I want to make a custom mouse

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
XxFullMetalxX
Prole
Posts: 9
Joined: Thu Jul 04, 2013 5:52 pm

I want to make a custom mouse

Post by XxFullMetalxX »

I want to make a custom mouse but The Image is black!

please help!
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: I want to make a custom mouse

Post by mickeyjm »

We need a little more information than that.
Can you provide us with a .love or at least a code snippet?
Your screen is very zoomed in...
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: I want to make a custom mouse

Post 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. :)
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
mickeyjm
Party member
Posts: 237
Joined: Thu Dec 29, 2011 11:41 am

Re: I want to make a custom mouse

Post 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.
Your screen is very zoomed in...
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: I want to make a custom mouse

Post 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.
"In those quiet moments, you come into my mind" - Liam Reilly
Post Reply

Who is online

Users browsing this forum: aikusuuta and 8 guests