Hello all,
I'm trying to set opacity on font but it's not working, maybe i'm doing something wrong:)
My code:
-- dedicated function to set hex color to r,g,b
local r,g,b = Utils:hex2rgb( color )
local o = 0.5
love.graphics.setColor(r,g,b,o)
love.graphics.setFont(font)
love.graphics.print( txt, x, y)
love.graphics.setColor(1, 1, 1, 1)
Thanks
Font transparency
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- BrotSagtMist
- Party member
- Posts: 657
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Font transparency
Hello, in fact if i put something else than 1 for opacity for the font it's not changing at all
-
- Party member
- Posts: 548
- Joined: Wed Oct 05, 2016 11:53 am
Re: Font transparency
A snippet like yours works fine on my end.
Are you sure you don't have anything that might interfere or influence the rendering somehow? An active shader, setting a blend mode, drawing to a canvas but forgetting to flush the canvas contents between frames, or something similar? If in doubt, post your full code.
Are you sure you don't have anything that might interfere or influence the rendering somehow? An active shader, setting a blend mode, drawing to a canvas but forgetting to flush the canvas contents between frames, or something similar? If in doubt, post your full code.
- BrotSagtMist
- Party member
- Posts: 657
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Font transparency
99% sure its split up in love.draw and love.load and hes just using locals because some tutorial told to do so.
For the record, using locals inside a function makes them disappear after that function. (unless you define other functions within said function)
For the record, using locals inside a function makes them disappear after that function. (unless you define other functions within said function)
obey
Re: Font transparency
Check it like this:
1. use black background in love.draw and do not do anything else there
2. then draw the text with various alpha color from range 0 to 1 and step 0.1 and you will see if there is difference.
1. use black background in love.draw and do not do anything else there
2. then draw the text with various alpha color from range 0 to 1 and step 0.1 and you will see if there is difference.
Code: Select all
function love.draw()
for alpha=0,1,0.1 do
love.graphics.setColor(1,0,0,alpha)
love.graphics.print("HELL0 WORLD alpha="..alpha,10,10+alpha*120)
end
end
Re: Font transparency
Thanks i'm gonna test it.
Who is online
Users browsing this forum: Bing [Bot], Semrush [Bot] and 2 guests