GUI Opacity

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
LordNyson
Posts: 31
Joined: Tue Nov 11, 2008 12:02 pm
Location: Perth, Australia

GUI Opacity

Post by LordNyson »

Wondering how to fix this problem. Basically I have drop down boxes, combo boxes. But when you drop down the one on top you can still see the others through it, I need a way to make it opaque. I have looked at trying to do it with gi->getSkin()->setColor() But I just can't seem to get it working. Can anyone help?

Image
But the cage only had "Warning: Vicious Lions" on it! Im a programmer! I only listen to errors!
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

Maybe it's because you setted a transparency? Could you post a sample code to let us test it?
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

This is because GUI elements as default are transparent. Try adjusting their transparency to 255 and see that theyre much brighter and theres no bug that you posted :)
LordNyson
Posts: 31
Joined: Tue Nov 11, 2008 12:02 pm
Location: Perth, Australia

Post by LordNyson »

Yeah I know it's not a bug, I just don't know how to do it! :P How do I adjust the transparency to 255? Is it part of the GUI object or part of each combo box? They are just default creation of a combo box, I just can't work out how to adjust the transparency of the combo-box background
But the cage only had "Warning: Vicious Lions" on it! Im a programmer! I only listen to errors!
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

Code: Select all

s32 alpha = 255;

for (u32 i = 0; i < EGDC_COUNT ; ++i)
{
	SColor color = env->getSkin()->getColor ((EGUI_DEFAULT_COLOR)i);
	color.setAlpha (alpha);
	env->getSkin()->setColor ((EGUI_DEFAULT_COLOR)i, color);
}
LordNyson
Posts: 31
Joined: Tue Nov 11, 2008 12:02 pm
Location: Perth, Australia

Post by LordNyson »

Thanks man, so basically that just sets every GUI elements Alpha to 255... it looks very... Windows 95ish, I will have to play around to get the right ones... but thanks for the code, in essence it does what I need.

More specifically for future reference:

SColor color = gi->getSkin()->getColor (EGDC_3D_HIGH_LIGHT);
color.setAlpha (225);
gi->getSkin()->setColor (EGDC_3D_HIGH_LIGHT, color);

Where EGDC_3D_HIGH_LIGHT = 3;
Last edited by LordNyson on Wed Aug 12, 2009 11:46 am, edited 1 time in total.
But the cage only had "Warning: Vicious Lions" on it! Im a programmer! I only listen to errors!
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

I think there are no functions to set a transparency to only one GUI Element.
Post Reply