Page 1 of 1

How make button with different skin?

Posted: Thu Aug 17, 2006 02:38
by iversion
I want to have two different kinds of buttons. For example, one use white color skin, the other use red color skin. I had two button skin in my tga file. But how can I assign the different skin to the buttons? Can I make it just by modifying the xml files, such as .looknfeel file?

Re: How make button with different skin?

Posted: Thu Aug 17, 2006 09:21
by Xirnohn
iversion wrote:I want to have two different kinds of buttons. For example, one use white color skin, the other use red color skin. I had two button skin in my tga file. But how can I assign the different skin to the buttons? Can I make it just by modifying the xml files, such as .looknfeel file?


Put it to a looknfeel like:

Code: Select all

<WidgetLook name="TaharezLook/ButtonWithWhiteSkin">
.
.
.
</WidgetLook>

<WidgetLook name="TaharezLook/ButtonWithRedSkin">
.
.
.
</WidgetLook>


Then in the shame file:

Code: Select all

<FalagardMapping WindowType="TaharezLook/ButtonWhite"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/ButtonWithWhiteSkin" />

and

Code: Select all

<FalagardMapping WindowType="TaharezLook/ButtonRed"      TargetType="CEGUI/PushButton"  Renderer="Falagard/Button"       LookNFeel="TaharezLook/ButtonWithRedSkin" />

You now have two button type:

Code: Select all

Button *redButton = WindowManager::getSingleton().createWindow("TaharezLook/ButtonRed", "redButton");
Button *whiteButton = WindowManager::getSingleton().createWindow("TaharezLook/ButtonWhite", "whiteButton");

I hope im right, and helps you.

Xir.

Posted: Thu Aug 17, 2006 13:17
by iversion
It works! Thank you very much! :)