I have two problem:
1) How to change the shape of a cegui window? for example, I want a circular button.
2) how to create two basic cegui window at same time. In other word, I want a combined window ,the combined window is composed of two basic cegui window.
How to change the shape of cegui window?
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Hi,
1) The level at which you can achieve this, if at all, will depend upon your exact needs...
If you just want round looking imagery then you can do that by just changing the looknfeel skin file or imageset definition, but you will be left with a round looking button that has square hit testing (that is, when the mouse is in the corner of the bounding rectangle but outside the circle, the button will react as if the mouse were within the circle).
If you need the hit test to only succeed if the cursor is within the innner circular area of the button, you would have to create a CEGUI::Window subclass of some kind and override the isHit member to provide a more accurate hit test (you would then need a WindowFactory for this new window type, and probably also an entry in the scheme file if you intend to use skinning).
This will leave you with a final potential issue of clipping; currently all imagery clipping is done to rectangular regions only, and this can not really be changed at present. So, if you can live with that limitation, it's possible but may be a little work.
2) This can be done by creating a WidgetLook that has the required Child definitions, and mapping that WidgetLook to an appropriate base type / window renderer in the scheme.
For example, for a window that's composed of two push buttons:
And with this entry in the scheme file:
You can use it, for example, like:
To target the component parts:
also see this article on auto windows.
CE.
1) The level at which you can achieve this, if at all, will depend upon your exact needs...
If you just want round looking imagery then you can do that by just changing the looknfeel skin file or imageset definition, but you will be left with a round looking button that has square hit testing (that is, when the mouse is in the corner of the bounding rectangle but outside the circle, the button will react as if the mouse were within the circle).
If you need the hit test to only succeed if the cursor is within the innner circular area of the button, you would have to create a CEGUI::Window subclass of some kind and override the isHit member to provide a more accurate hit test (you would then need a WindowFactory for this new window type, and probably also an entry in the scheme file if you intend to use skinning).
This will leave you with a final potential issue of clipping; currently all imagery clipping is done to rectangular regions only, and this can not really be changed at present. So, if you can live with that limitation, it's possible but may be a little work.
2) This can be done by creating a WidgetLook that has the required Child definitions, and mapping that WidgetLook to an appropriate base type / window renderer in the scheme.
For example, for a window that's composed of two push buttons:
Code: Select all
<WidgetLook name="TaharezLook/DoubleButton">
<Child type="TaharezLook/Button" nameSuffix="__auto_button1__">
<Area>
<Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
<Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
<Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
<Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
</Area>
</Child>
<Child type="TaharezLook/Button" nameSuffix="__auto_button2__">
<Area>
<Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
<Dim type="TopEdge" ><UnifiedDim scale="0.5" type="TopEdge"/></Dim>
<Dim type="Width" ><UnifiedDim scale="1" type="Width" /></Dim>
<Dim type="Height" ><UnifiedDim scale="0.5" type="Height" /></Dim>
</Area>
</Child>
<StateImagery name="Enabled" />
</WidgetLook>
And with this entry in the scheme file:
Code: Select all
<FalagardMapping WindowType="TaharezLook/DoubleButton" TargetType="DefaultWindow" Renderer="Falagard/Default" LookNFeel="TaharezLook/DoubleButton" />
You can use it, for example, like:
Code: Select all
Window* db = winMgr.createWindow("TaharezLook/DoubleButton",
"myDoubleButton");
To target the component parts:
Code: Select all
db->getChild( db->getName() + "__auto_button1__" )->
setText( "Button 1" );
db->getChild( db->getName() + "__auto_button2__" )->
setText( "Button 2" );
also see this article on auto windows.
CE.
Thank CrazyEddie
Thank CrazyEddie!
Who is online
Users browsing this forum: No registered users and 19 guests