Setting up the 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

MrDoom
Just popping in
Just popping in
Posts: 12
Joined: Sun May 04, 2008 00:24

Setting up the resources

Postby MrDoom » Mon May 05, 2008 15:48

Hey, me again.

Been trying to get CEGUI to load in some resources by following this and this.

From this I have gotten the following code:

Code: Select all

bool GUI::initialise(LPDIRECT3DDEVICE9 d3dDevice9)
{
   // Make sure we are not reinitialising.
   if(!m_ceguiRenderer)
   {
      // Setup the Renderer.
      m_ceguiRenderer = new CEGUI::DirectX9Renderer(d3dDevice9, 0);

      // Initialise the CEGUI system.
      new CEGUI::System(m_ceguiRenderer);

      // Initialise the resource provider.
      CEGUI::DefaultResourceProvider *rp = static_cast<CEGUI::DefaultResourceProvider*>
                                  (CEGUI::System::getSingleton().getResourceProvider());
      rp->setResourceGroupDirectory("schemes",    "datafiles/schemes");
      rp->setResourceGroupDirectory("imagesets",    "datafiles/imagesets");
      rp->setResourceGroupDirectory("fonts",       "datafiles/fonts");
      rp->setResourceGroupDirectory("layouts",    "datafiles/layouts");
      rp->setResourceGroupDirectory("looknfeels",  "datafiles/looknfeel");
      rp->setResourceGroupDirectory("lua_scripts", "datafiles/lua_scripts");

      // Set the default resource groups.
      CEGUI::Imageset::setDefaultResourceGroup("imagesets");
      CEGUI::Font::setDefaultResourceGroup("fonts");
      CEGUI::Scheme::setDefaultResourceGroup("schemes");
      CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
      CEGUI::WindowManager::setDefaultResourceGroup("layouts");
      CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");

      // Load the scheme file.
      CEGUI::SchemeManager::getSingleton().loadScheme("VanillaSkin.scheme");

      // Load in a font.
      if(!CEGUI::FontManager::getSingleton().isFontPresent("Commonwealth-10"))
         CEGUI::FontManager::getSingleton().createFont("Commonwealth-10.font");

      // Setup the mouse.
      CEGUI::System::getSingleton().setDefaultMouseCursor("VanillaSkin", "MouseArrow");

      // Setup the tooltips.
      CEGUI::System::getSingleton().setDefaultTooltip("VanillaSkin/Tooltip");

      return true;
   }
   return false;
}


But it's throwing an exception when it calls "CEGUI::SchemeManager::getSingleton().loadScheme("VanillaSkin.scheme");".

05/05/2008 16:29:51 (Std) ---- CEGUI System initialisation completed ----
05/05/2008 16:29:51 (Std) ---- Version 0.6.0 ----
05/05/2008 16:29:51 (Std) ---- Renderer module is: CEGUI::DirectX81Renderer - Official Direct3D 9 based renderer module for CEGUI ----
05/05/2008 16:29:51 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
05/05/2008 16:29:51 (Std) ---- Scripting module is: None ----
05/05/2008 16:29:51 (Std) Attempting to load Scheme from file 'VanillaSkin.scheme'.
05/05/2008 16:29:51 (Error) CEGUI::InvalidRequestException in file c:\downloads\cegui-0.6.0\cegui-0.6.0\src\ceguidefaultresourceprovider.cpp(54) : DefaultResourceProvider::load - VanillaSkin.scheme does not exist
05/05/2008 16:29:51 (Error) Scheme::Scheme - loading of Scheme from file 'VanillaSkin.scheme' failed.

From looking in my log file, I can see that it can't find the ".scheme" file. Something else which is also strange is that it's using the header file from "c:\downloads\cegui-0.6.0\cegui-0.6.0\src\ceguidefaultresourceprovider.cpp" but that's not where I have the include path set to :?

My "datafiles" directory is in the same directory as my exe, so it's like:
- Bla.exe
- datafiles/

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

Postby CrazyEddie » Mon May 05, 2008 17:38

Hi,

The trailing slash on the directories you specify for the groups is important (yes, we should be checking that in the lib, but currently do not).

so...

Code: Select all

...
rp->setResourceGroupDirectory("schemes",    "datafiles/schemes/");
rp->setResourceGroupDirectory("imagesets",    "datafiles/imagesets/");
rp->setResourceGroupDirectory("fonts",       "datafiles/fonts/");
rp->setResourceGroupDirectory("layouts",    "datafiles/layouts/");
rp->setResourceGroupDirectory("looknfeels",  "datafiles/looknfeel/");
rp->setResourceGroupDirectory("lua_scripts", "datafiles/lua_scripts/");
...


HTH

CE.

MrDoom
Just popping in
Just popping in
Posts: 12
Joined: Sun May 04, 2008 00:24

Postby MrDoom » Mon May 05, 2008 18:52

Yay, that fixed it up. Thanks.

I'm having this issue now :(


Return to “Help”

Who is online

Users browsing this forum: No registered users and 25 guests