Newbie Color Question
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Newbie Color Question
When I load images, everything seems ok, but when I tell love to draw images, they all seem washed out, like the alpha has been lowered or something. any idea why this might be happening?
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Newbie Color Question
Could you show the code you're using. We can't help much with so little information.
Re: Newbie Color Question
Code: Select all
function love.load()
......
pc={122,150,191}
love.graphics.setColorMode("replace")
love.graphics.setBackgroundColor(51,51,51)
end
Code: Select all
function love.draw()
love.graphics.setColor(pc)
love.graphics.line(paddle[2].x, paddle[2].y, paddle[2].x, paddle[2].y+92)
end
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Newbie Color Question
That code doesn't have any images in it... Just lines and colors.
Re: Newbie Color Question
I was only posting the relevant parts. My point is if I use images instead of the code above, everything's cool, but the code above produces washed out colors even though it should be the same as their image equivalents.
Re: Newbie Color Question
Try changing this line:to:
Code: Select all
pc={122, 150, 191}
Code: Select all
pc={122, 150, 191, 255}
Request Programs
If Linux were a beer, it would be shipped in open barrels so that anybody could piss in it before delivery
If Linux were a beer, it would be shipped in open barrels so that anybody could piss in it before delivery
Re: Newbie Color Question
that's what I had before, but it doesn't seem to change at all. I think 255 is the default so I just took it off. decreasing it definitely makes a difference, but putting 255 and putting nothing seem to be equivalent.
is it normal on everyone else's computer? :/
is it normal on everyone else's computer? :/
Re: Newbie Color Question
Yes, the alpha defaults to 255 in that case.
I see that you use love.graphics.setColorMode, so I'm assuming you know that the color you set with love.graphics.setColor affects images.
The color in images never were a problem for me. Maybe you could expand your code example a bit more.
I see that you use love.graphics.setColorMode, so I'm assuming you know that the color you set with love.graphics.setColor affects images.
The color in images never were a problem for me. Maybe you could expand your code example a bit more.
Shallow indentations.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Newbie Color Question
You have to set the color back to white (255,255,255) before drawing your images, otherwise they will be "tinted" (it's more appropiate than "washed out") with the previous color you set.
This is useful in some cases - think about the different faction colors on strategy game. Instead of creating one image set per color (red soldier, blue soldier, pink soldier ...) this allows you to create just one "soldier", and then "tint" it (in some cases you will need two - "soldier" and "soldier_colors", only "soldier_colors" being tintable).
This is useful in some cases - think about the different faction colors on strategy game. Instead of creating one image set per color (red soldier, blue soldier, pink soldier ...) this allows you to create just one "soldier", and then "tint" it (in some cases you will need two - "soldier" and "soldier_colors", only "soldier_colors" being tintable).
When I write def I mean function.
Re: Newbie Color Question
where am I putting the reset to white? I put it in a bunch of places but still seeing color differences.
Code: Select all
function love.draw()
love.graphics.setColor(255,255,255)
love.graphics.setColor(pc)
love.graphics.line(paddle[2].x1, paddle[2].y1, paddle[2].x2, paddle[2].y2)
love.graphics.setColor(255,255,255)
love.graphics.draw(paddlei, paddle[1].x1, paddle[1].y1)
love.graphics.draw(balli, bx-balli:getWidth()/2, by-balli:getHeight()/2)
love.graphics.print(p1,5,5) love.graphics.print(p2,x-13,5)
love.graphics.setColor(255,255,255)
end
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], kov_serg and 6 guests