images with their own transparency

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
atcdevil
Posts: 30
Joined: Sun Mar 14, 2004 2:14 am

images with their own transparency

Post by atcdevil »

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=3269

This addon is dependent on the bug fix from that thread. Once that fix is made. You can make images have their own individual colors (including tranparencies) by doing this:

Add this to IGUIImage.h:

Code: Select all

virtual void setOverrideColor(video::SColor color) = 0;
Add this to CGUIImage.h:

Code: Select all

virtual void setOverrideColor(video::SColor color);
In CGUIImage.cpp:

In draw change:

Code: Select all

	if (Texture)
		driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner, 
			core::rect<s32>(core::position2d<s32>(0,0), Texture->getOriginalSize()),
							&AbsoluteClippingRect);
to

Code: Select all

	if (Texture)
		driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner, 
			core::rect<s32>(core::position2d<s32>(0,0), Texture->getOriginalSize()),
							&AbsoluteClippingRect, OverrideColor, true);
And add:

Code: Select all

void CGUIImage::setOverrideColor(video::SColor color)
{
	OverrideColor = color;
}
Assuming you compile your code to use OpenGL, and have applied the fix in the thread I referenced, you should be able to set override colors for gui image's so each could have individual transparencies.
Post Reply