(C++)chatQue class [v0.2.3] Alpha Fade works w/ 1.2
Halan, I have the same warnings as you under VS 2005.
Just declare this after the #define at the top of the header:
It fixes the annoying warnings very nicely
Just declare this after the #define at the top of the header:
Code: Select all
#pragma warning( disable : 4996 4244 4156 4154)
oh i dont really care about the warnings i just wanted to inform you cause i didnt know if they could maybe cause some problems...
My Blog: http://www.freakybytes.org
Hey Halen, I *think* I fixed warnings you pointed out. (I don't have irrlicht set up in visual studios at the moment) Could you double check the code in visual studio and confirm they are gone?
Thanks.
*Edit, the current version is in this post only, I havent uploaded it to the direct download location yet.
Thanks.
*Edit, the current version is in this post only, I havent uploaded it to the direct download location yet.
Re: (C++) chatQue class [v0.2.3] *Visual Studio Warnings Fix
Here's the code for an alpha fade. In the existing code, you have this:Rambus wrote: -Somehow implement alpha fade rather then fade to black
(If you make any of these changes, please post the code befor I do it myself!)
Code: Select all
//Fade code
f32 l_alpha = ( (f32)(l_time - iter->fade)/(f32)chatQue_fadeTime );
iter->color1 = iter->color1Fade.getInterpolated(SColor(0,0,0,0),1-l_alpha);
iter->color2 = iter->color2Fade.getInterpolated(SColor(0,0,0,0),1-l_alpha);
Code: Select all
//Fade code
f32 l_alpha = ( (f32)(l_time - iter->fade)/(f32)chatQue_fadeTime );
iter->color1.setAlpha(iter->color1Fade.getAlpha() * (1-l_alpha));
iter->color2.setAlpha(iter->color2Fade.getAlpha() * (1-l_alpha));
Oh yeah, a couple more things.
1. gcc complains about the switch statements that don't have a default: case. Its just a warning, but it gets in the way if you use -Werror (warnings as errors).
2. I can confirm that the code works fine on Mac OS X too. Give me a month or so and I'll be able to check Linux as well. Not that I expect any problems.
1. gcc complains about the switch statements that don't have a default: case. Its just a warning, but it gets in the way if you use -Werror (warnings as errors).
2. I can confirm that the code works fine on Mac OS X too. Give me a month or so and I'll be able to check Linux as well. Not that I expect any problems.
@ssexton
-Fade code,
What version of irrlicht are you using, that makes that fade code work? My problem is that regardless of what alpha value I give the text, it won't become transparent.
-I didn't know about the default warning in gcc, thanks for the heads up. I will fix it right now.
-Thanks for testing it on other OS's, If you find any problems with it running under linux be sure to let me know.
-Fade code,
What version of irrlicht are you using, that makes that fade code work? My problem is that regardless of what alpha value I give the text, it won't become transparent.
-I didn't know about the default warning in gcc, thanks for the heads up. I will fix it right now.
-Thanks for testing it on other OS's, If you find any problems with it running under linux be sure to let me know.
Hm. Come to think of it, I didn't look too closely to see if the alpha fade was actually fading. I was just happy to get rid of the black. My bad.
Still, I'm 99% sure that the setAlpha() is the code you want to do a fade effect. That's what alpha *is*, and it's how I've done it before in "pure" OpenGL apps. So if its not actually fading out, my guess is that alpha blending is disabled in the video driver when you're drawing the font textures. I don't know Irrlicht well enough yet to know where to start looking for that. But I'd almost bet money that's what the issue is.
Still, I'm 99% sure that the setAlpha() is the code you want to do a fade effect. That's what alpha *is*, and it's how I've done it before in "pure" OpenGL apps. So if its not actually fading out, my guess is that alpha blending is disabled in the video driver when you're drawing the font textures. I don't know Irrlicht well enough yet to know where to start looking for that. But I'd almost bet money that's what the issue is.
Ah, well I'm using irrlicht 1.1 release, so I imagine the dx fading is fixed in the svn version. For the time being I will leave your alternative code commented out, and the fade to black in. Thanks for checking that for me ssexton!
Edit: actually I can't recall if I tested the fade code for dx9 and irr 1.1, I will give that a check on the weekend. If that works I will probably make the dx driver fade alpha, and the opengl fall back of fading to black.
Double Edit: No, both dx and openGL of the current irrlicht release fail to alter the alpha. I guess I will have to wait for the next release.
Edit: actually I can't recall if I tested the fade code for dx9 and irr 1.1, I will give that a check on the weekend. If that works I will probably make the dx driver fade alpha, and the opengl fall back of fading to black.
Double Edit: No, both dx and openGL of the current irrlicht release fail to alter the alpha. I guess I will have to wait for the next release.