Getting rid of XML resources

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Salbutamol
Just popping in
Just popping in
Posts: 5
Joined: Mon Oct 12, 2009 13:55

Getting rid of XML resources

Postby Salbutamol » Mon Oct 12, 2009 14:08

Hi guys.

I'm just wondering if it's possible to get rid of all the XML by cegui and load everything programmatically. Now you may think this makes no sense but it would be nice for me to know that I have this possibility. Having XML that are parsed at every startup of a game, when the output is always the same makes little sense. I would prefer to just populate everything with function calls, which would be much faster and it reduces the file dependencies.

Also it simplifies support enormously. Consider a normal file corruption, it's easy to know when a binary is corrupt but how do you detect that a xml is corrupt? Your user will never be able to tell and you'll end up telling them to reinstall the game in many cases. The less stuff that is outside the binary the better. Also, currently my app consists of a single exe which is pretty cool, I wouldn't want to lose this because of cegui,

So, is this possible at all?
- For XML resources, to construct them with calls to the api.
- For binary resources such as fonts and imageset textures to have them as resources of your exe and send them to cegui somehow.

If so, any pointers would be appreciated. (And please don't do like many open source projects and just tell me that I don't need to do this, I have my own reasons and I would like to know if it's possible).

Thanks in advance!

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Getting rid of XML resources

Postby Jamarr » Mon Oct 12, 2009 18:13

You can always create a custom ResourceProvider. There are no existing ResourceProviders that do what you want, afaik. I think the OGRE ResourceProvider can load resources from zip files. I don't suspect it would be too difficult to create a custom provider to load resources from a binary file and/or directly from memory/the exe.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Getting rid of XML resources

Postby CrazyEddie » Mon Oct 12, 2009 19:45

(And please don't do like many open source projects and just tell me that I don't need to do this, I have my own reasons and I would like to know if it's possible).

This is actually one of my pet hates. The number of times you see it on forums where a very specific question is asked, and rather than seeing the question answered you'll invariably find a dozen guys saying why not to do that, and how they'd do it instead - well that's all fine and dandy, but it's not what was asked :evil: I think it's totally cool for people to give alternative ideas and implementations, BUT ANSWER THE FUCKING QUESTION, TOO!! :hammer:

Anyway, getting back to CEGUI...
It is generally possible to create via code everything that's possible to create via XML files (somewhat version dependant, since there was/is some nasty 'friend' abuse going on, especially in the Font classes - I don't remember if I removed that in 0.7.0 or just grimaced and thought that I'll get rid of it later!). The interfaces for doing this are sometimes less documented (thinking of the Falagard stuff here), but they are there (you'd have to ask for specifics, once you get that far). This being said, defining an entire looknfeel skin in code is not something I'd ever want to try :lol: (But, the question you asked is answered :P)

I do think Jamarr's suggestion of a custom ResourceProvider that accesses resources from the executable module is the way to go. So you'll perhaps still have XML - at least for some things (thinking of skin definitions here) - but it's embedded with the other resources and so allows you to maintain your single file approach.

BTW, to get a single file linked output for CEGUI (i.e. no DLLs at all), you'll likely need the v0-7 svn code and the updated dependencies since prior to this we had some issues and some of the deps were still DLL based even for static linking. The 0.7.1 release will fix this (expected some time in the next couple of weeks).

CE.

Salbutamol
Just popping in
Just popping in
Posts: 5
Joined: Mon Oct 12, 2009 13:55

Re: Getting rid of XML resources

Postby Salbutamol » Mon Oct 26, 2009 12:33

Sorry for reviving an old thread, I wanted to answer sooner but I didn't have my password at hand and since you can't recover a pass... (I know, I know it's sourceforge's fault).
So thanks a lot for your answers. I think I'll try the resource provider route and just have my XML's as constants or resources in my exe, doesn't solve the efficiency problem but it gives me what I want for support reasons.

This is actually one of my pet hates. The number of times you see it on forums where a very specific question is asked, and rather than seeing the question answered you'll invariably find a dozen guys saying why not to do that, and how they'd do it instead - well that's all fine and dandy, but it's not what was asked I think it's totally cool for people to give alternative ideas and implementations, BUT ANSWER THE FUCKING QUESTION, TOO!!


haha, yeah, i hate that too. I was specially bitter the day I created this thread because I had asked 2 questions in Ogre's forums and I got the same answer both times, saying that I don't really need that, and one of them was *really* rude.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 19 guests