How to make the checkbox tick white?

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
D.Cent
Posts: 18
Joined: Sun May 13, 2007 8:12 pm
Location: Schwieberdingen (Germany)
Contact:

How to make the checkbox tick white?

Post by D.Cent »

Hi,
I just made my own GUI skin and I'd like to make the checkbox tick white now - is there a possibility to do that? Has anyone got some example code?

Thanks in advance!
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: How to make the checkbox tick white?

Post by randomMesh »

Untested, but something like this should work.

Code: Select all

skin->setColor(EGDC_ICON_HIGH_LIGHT, video::SColor(255, 255, 255, 255));
http://irrlicht.sourceforge.net/docu/namespaceirr_1_1gui.html#abd15860fde29833c48daff5f95d5467a
"Whoops..."
D.Cent
Posts: 18
Joined: Sun May 13, 2007 8:12 pm
Location: Schwieberdingen (Germany)
Contact:

Post by D.Cent »

Hm... it's still black :-/
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Post by Seven »

Code: Select all

//! draws the element and its children
void CGUICheckBox::draw()
{
	if (!IsVisible)
		return;

	IGUISkin* skin = Environment->getSkin();

	core::rect<s32> rect = AbsoluteRect;

	s32 height = skin->getSize(EGDS_CHECK_BOX_WIDTH);

	core::rect<s32> checkRect(AbsoluteRect.UpperLeftCorner.X,
				((AbsoluteRect.getHeight() - height) / 2) + AbsoluteRect.UpperLeftCorner.Y,
				0, 0);

	checkRect.LowerRightCorner.X = checkRect.UpperLeftCorner.X + height;
	checkRect.LowerRightCorner.Y = checkRect.UpperLeftCorner.Y + height;

	skin->draw3DSunkenPane(this, skin->getColor(Pressed || !IsEnabled ? EGDC_3D_FACE : EGDC_ACTIVE_CAPTION),
		false, true, checkRect, &AbsoluteClippingRect);

	 if (Checked && Environment->getSkin())
		Environment->getSkin()->drawIcon(this, EGDI_CHECK_BOX_CHECKED, checkRect.getCenter(),
			checkTime, os::Timer::getTime(), false, &AbsoluteClippingRect);
	if (Text.size())
	{
		checkRect = AbsoluteRect;
		checkRect.UpperLeftCorner.X += height + 5;

		IGUIFont* font = skin->getFont();
		if (font)
			font->draw(Text.c_str(), checkRect,
			skin->getColor(EGDC_BUTTON_TEXT), false, true, &AbsoluteClippingRect);
	}

	IGUIElement::draw();
}

if (Checked && Environment->getSkin())
Environment->getSkin()->drawIcon(this, EGDI_CHECK_BOX_CHECKED, checkRect.getCenter(),
checkTime, os::Timer::getTime(), false, &AbsoluteClippingRect);
Post Reply