Easing into falagard

Discussion regarding the development of CEGUI itself - as opposed to questions about CEGUI usage that should be in the help forums.

Moderators: CEGUI MVP, CEGUI Team

User avatar
gcarlton
Just can't stay away
Just can't stay away
Posts: 149
Joined: Wed Jan 12, 2005 12:06

Easing into falagard

Postby gcarlton » Thu Jun 02, 2005 01:33

I've just noticed that there is actually a fairly simple path to the holy grail of data driven widgets. It would also allow you to easily alias the widget set to something normal, like "MyLook", and not have to insert the specifics of TaharezLook or WindowsLook in all the data.

Currently I am using TL, so there is one button, TaharezLook/Button. The xml file lists the name, and then the TL dll interprets that and creates a factory object for the button. Then when we want a TL/Button, the factory object creates it. Here's the current line:

Code: Select all

<WindowFactory Name="TaharezLook/Button" />

Now what if we wanted two types of buttons. Well, it isn't that hard! We'd need to create two factory objects, each of which creates a TLButton instance. If we change the code so it supports a separate name to the actual factory type, we'd have this:

Code: Select all

<WindowFactory Name="TaharezLook/Button" />
<WindowFactory Name="TaharezLook/RoundButton" Widget="TaharezLook/Button" />

So with a small change, we've now created two button factories. How to get them looking different? WindowFactory could keep a list of {name,value} string pairs from the xml file. So we'd have it like this:

Code: Select all

<WindowFactory Name="TaharezLook/RoundButton" Widget="TaharezLook/Button" >
 <Data Name="NormalImage" Value="TaharezLook/Round1" />
 <Data Name="PushedImage" Value="TaharezLook/Round2" />
 <Data Name="DisabledColour" Value="0xff808080" />
</WindowFactory>

Ok, the code creates the window factory, then pushes data into it. Now we'd need to change the creation so that the widgets created get a pointer back to their WindowFactory. In that case, the TLButton could then pick off the data:

Code: Select all

if (myFactory->doesExist("NormalImage"))
{
  d_middleSectionHover = &iset->getImage(myFactory->getString("NormalImage"));
  d_mycolour = myFactory->getInteger("DisabledColour"));
}
else
{
  .. hard coded default way
}

In summary, the road to Falagard isn't that rocky at all. Rather than throwing away two implementations, we could gradually migrate them by slowly allowing an override of all the appropriate values. At all points in this process everything still works, it just gets more powerful. Eventually you could merge the two dlls, taking the best implementation of each. For instance sometimes TL assumes a 1x1 image, WL assumes 3x3. So you might end up taking the best of the two. It would be easy to mix and match until this happened, e.g.:

Code: Select all

<WindowFactory Name="MyLook/Button" Widget="TaharezLook/Button" />
... the TL button is better
<WindowFactory Name="MyLook/BigFatMommaButton" Widget="TaharezLook/Button" />
... same with new data driven fields
<WindowFactory Name="MyLook/Scrollbar" Widget="WindowsLook/Scrollbar/>
... but i like the WL scrollbar

Note: This is one of those useless posts where I state something but then don't go ahead and implement it. Still, its a good concept. 8)

User avatar
_mental_
CEGUI Team (Retired)
Posts: 157
Joined: Wed Jan 12, 2005 12:06
Contact:

Re: Easing into falagard

Postby _mental_ » Thu Jun 02, 2005 02:48

In a few days I'm going to be posting a new roadmap. The main change is actually giving priority to the data driven look and having less of an emphasis on creating new widgets. I feel that it is essential to get it up and running as creating new looks seems to be a major sticking point with some users.


Return to “CEGUI Library Development Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests