Is there a built in way to draw a sprite with alpha (so I can fade them in/out)? You can draw text with alpha, but that has some other issues like not being able to handle the pivot freely etc.
SamiV.
Drawing sprites with alpha?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Drawing sprites with alpha?
You can use setColor in combination with love.color_modulate. (which is an argument to setColorMode)
Re: Drawing sprites with alpha?
Ahh, thanks! I tried just setColor, didn't think that I need to set the blend mode as well (and I made a hack that abuses the font system...
SamiV.
SamiV.
Re: Drawing sprites with alpha?
The love.color_modulate setting should totally be the default color mode. (Already added to tracker).
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Drawing sprites with alpha?
We should be able to set image alpha ourselves without having to use the color part. I can't figure out how to set the color with alpha without setting the color. I don't want to set the color. Just the opacity. Opacity should be a parameter of the drawing commands.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Drawing sprites with alpha?
Just the opacity? As inJasoco wrote:We should be able to set image alpha ourselves without having to use the color part. I can't figure out how to set the color with alpha without setting the color. I don't want to set the color. Just the opacity. Opacity should be a parameter of the drawing commands.
Code: Select all
local c = love.graphics.getColor()
c:setAlpha(A)
love.graphics.setColor(c)
Help us help you: attach a .love.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Drawing sprites with alpha?
Yeah, that works.. Kind of. A bit unwieldy though. I have to make sure to set the alpha back to full after doing the transparent images or else it draws other stuff transparent. It just seems silly to set the alpha to one thing then have to set it right back so everything else doesn't take on the opacity as well. Especially when we want to fade things in or out and have to constantly be changing the color:setAlpha every frame.
It would be much easier if opacity was just another parameter when calling draw functions. Angle, Scale, Opacity. You know?
It would be much easier if opacity was just another parameter when calling draw functions. Angle, Scale, Opacity. You know?
Re: Drawing sprites with alpha?
yea until you dont need it, which is often
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Drawing sprites with alpha?
I'm not sure, but maybe
works as well? That would at least be slightly closer to the simplicity of an argument to a function.
Code: Select all
love.graphics.getColor():setAlpha(A)
Help us help you: attach a .love.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Drawing sprites with alpha?
I can't figure out how to make images transparent. For some reason it seems to only be affecting text.
I'm sorry but this is implemented very strangely. The opacity value should be part of the draw function like angle and scale are. The color stuff only seems to affect text. Which is fine, if I want to make text transparent. But how do I make an image draw opaque?
I'm sorry but this is implemented very strangely. The opacity value should be part of the draw function like angle and scale are. The color stuff only seems to affect text. Which is fine, if I want to make text transparent. But how do I make an image draw opaque?
Who is online
Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Google [Bot] and 9 guests