Config XML file

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

kintaroe
Just popping in
Just popping in
Posts: 9
Joined: Wed Jan 26, 2011 11:45

Config XML file

Postby kintaroe » Mon Feb 21, 2011 10:22

Hello,

I would like to use the xml file to configurate my GUI, as described here

http://www.cegui.org.uk/docs/current/xml_config.html

unfortunately I'm not able to write one by myself because I don't understand if I can put in that file only a part of settings or whether I have to put all the settings.

For example, I tried with this small file:

Code: Select all

<CEGUIConfig>
  <Logging level="Insane"></Logging>
  <ResourceDirectory group="imagesets" directory="c:\\imagesets\\"></ResourceDirectory>
</CEGUIConfig>


The Expat parser throws a generic exeption saying it's "bad formed" at line 1.
CEGUIExpatParser.cpp line 78

Can someone post a working config file?
Can someone explain where the directory relative path is referred ?

Thanks a lot.

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

Re: Config XML file

Postby CrazyEddie » Tue Feb 22, 2011 11:49

You definitely don't need to put all of the tags and such into a config file.

The error you have is basically saying that Expat can't even understand the file at all, this may indicate an issue with file encoding, or you could be required to have the:

Code: Select all

<?xml version="1.0" ?>

header in the xml file.

Right at this minute I'm not able to test a working CEGUIConfig, so can't post one; but if the above does not help, I will do so later on.

Can someone explain where the directory relative path is referred ?

I don't understand the question. But... Relative paths are taken relative to the working directory at the time a resource is loaded.

HTH

CE.

kintaroe
Just popping in
Just popping in
Posts: 9
Joined: Wed Jan 26, 2011 11:45

Re: Config XML file

Postby kintaroe » Thu Feb 24, 2011 10:17

CrazyEddie wrote:You definitely don't need to put all of the tags and such into a config file.


Very good.

CrazyEddie wrote:
Can someone explain where the directory relative path is referred ?



Sorry for my english, you answered to my question :-D

I put the header, and it seems to parse the file but it still does not read data.

As first attempt I just wanted to write the schemes directory via file instead that via code

Code: Select all

<?xml version="1.0" ?>
<CEGUIConfig>
  <ResourceDirectory group="schemes" directory="../datafiles/schemes/"></ResourceDirectory>
</CEGUIConfig>


My load code is

Code: Select all

Direct3D9Renderer& renderer(Direct3D9Renderer::create(m_pkRenderer->GetDevice()));
      
DefaultResourceProvider* rp = new CEGUI::DefaultResourceProvider();
      
System::create(renderer, rp, 0, 0, 0, "..\\datafiles\\configs\\Cegui.conf");

// here I want to verify config loading
String string = rp->getResourceGroupDirectory("schemes");
const char* pstr = string.c_str();

// pstr IS AN EMPTY STRING, I EXPECT TO BE "../datafiles/schemes/"

// then I set via code
rp->setResourceGroupDirectory(   "schemes",  "../datafiles/schemes/" );

string = rp->getResourceGroupDirectory("schemes");
const char* pstr2 = string.c_str();

// now pstr2 IS CORRECTLY "../datafiles/schemes/"



There's still something I'm missing...

thanks for help

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

Re: Config XML file

Postby CrazyEddie » Fri Feb 25, 2011 09:04

Ok, looking at your code, the issue is because you explicitly pass a ResourceProvider to the System::create function.

The docs for <ResourceDirectory> in CEGUIConfig XML states:
Purpose:
* Specifies a resource group directory location. This is currently only used with automatically created instances of the DefaultResourceProvider, using this element with any other configuration will have no effect.

The part I have highlighted in boldface is the key to this issue :)

Basically if you remove that explicit creation - passing a zero pointer - and instead allow CEGUI to create the DefaultResourceProvider instance, things should work :)

HTH

CE.

kintaroe
Just popping in
Just popping in
Posts: 9
Joined: Wed Jan 26, 2011 11:45

Solved: Config XML file

Postby kintaroe » Mon Feb 28, 2011 08:53

It works!

I definitely had to read docs more accurately!

Thank you very much!


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 11 guests