Problems loading/using schemes

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

Endar
Just popping in
Just popping in
Posts: 3
Joined: Thu Sep 28, 2006 05:30

Problems loading/using schemes

Postby Endar » Thu Sep 28, 2006 08:21

I've just started trying to use CEGUI, and attempting to integrate it with my own graphics engine. I've been following the first few tutorials and I have a problem in creating even just a simple single window.

Code: Select all

// create the renderer object for the GUI
CEGUI::OpenGLRenderer* myRenderer = new CEGUI::OpenGLRenderer(NULL);

// create the GUI system object (singleton)
new CEGUI::System(myRenderer);

// Load the Taharez scheme
CEGUI::SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");

// create a window
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();

CEGUI::Window* myRoot = wmgr.createWindow("DefaultWindow", "root");

// Sets the passed window heirachy as the root (does not destroy the old one, just doesn't use it.
// We can just switch between window heirachies by calling 'setGUISheet')
CEGUI::System::getSingleton().setGUISheet(myRoot);

// create a window of type FrameWindow using the "Taharez" widget set
CEGUI::FrameWindow* fWnd = (CEGUI::FrameWindow*) wmgr.createWindow("TaharezLook/FrameWindow", "testWindow");

// attatch the window to the heirachy we created above
myRoot->addChildWindow(fWnd);

// set the window's initial position and size
fWnd->setPosition( CEGUI::Point(0.25f, 0.25f) );
fWnd->setSize( CEGUI::Size(0.5f, 0.5f) );

// set the caption of the window's title bar
fWnd->setText("Hello World!");


This is what I have so far, most of it just straight from the first 3 tutorials.

The program crashes when I attempt to run it with an "unusual termination" error. I've stepped through, line by line and found that I get an CEGUI::InvalidRequestException at the line where I call 'loadScheme'.

I have copied all the TaharezLook files from the CEGUI SDK folder, into the folder where the IDE (VC++ 2005 Express) sets the environment when running apps from inside the IDE, which is the same place that I've copied the CEGUI dll's.

If I remove the 'loadScheme' function call, I get a CEGUI::UnknownObjectException at the 'createWindow' call where I attempt to create a window using the TaharezLook scheme, which actually prompted me to insert the 'loadScheme' call.

I'm not really sure of what else I should be trying.

Edit:: Aha!! Log files are useful! :D

I took a look at the log file, and as anyone else here would probably be able to tell me, CEGUI attempted to load all the other assests that are required for a GUI, such as an image set. Unfortunately it attempted to load it from the "../datafiles/imagesets/" directory.

I'm assuming that I don't actually need to load things from there. Is it possible to change this directory, so I can just copy all the assests for a particular project into it's own directory and reference everything from there? I mean, without editing the XML files?

Or would it ultimately be easier to just create my own schemes for each project and use them?

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Postby spannerman » Thu Sep 28, 2006 09:14

Yeah the log file is usually very helpful, try increasing the amount it logs, I think you can set the logging level to something called "Insane".

Are you using Ogre? If so, make sure Ogre has all the CEGUI datafiles and media deirectories listed in its resources.config file.

If you take a look in the XML data files (imageset, looknfeel, font etc.) there are usually paths defined at the top pointing to the other datafiles. Make sure these paths are valid and you should be ok.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Thu Sep 28, 2006 10:11

Hello Endar,

assuming you are using version 0.5, this wiki page explains the thing you're looking for (regarding the assets question): http://www.cegui.org.uk/wiki/index.php/ ... s_in_0.5.0

This requires that you strip all path info from your xml files, since the path (e.g. ../datafiles/imagesets/) will now get appended by the resource loader.

And the loglevel reply from Spannerman is a good suggestion as well!

Good luck! :-)

Endar
Just popping in
Just popping in
Posts: 3
Joined: Thu Sep 28, 2006 05:30

Postby Endar » Fri Sep 29, 2006 02:58

scriptkid wrote:Hello Endar,

assuming you are using version 0.5, this wiki page explains the thing you're looking for (regarding the assets question): http://www.cegui.org.uk/wiki/index.php/ ... s_in_0.5.0

This requires that you strip all path info from your xml files, since the path (e.g. ../datafiles/imagesets/) will now get appended by the resource loader.

And the loglevel reply from Spannerman is a good suggestion as well!

Good luck! :-)


Actually, no, I'm using 0.4.1, the SDK download that is available. The 0.5 downloads are still candidate and not finalized, right?

Endar
Just popping in
Just popping in
Posts: 3
Joined: Thu Sep 28, 2006 05:30

Postby Endar » Sat Oct 28, 2006 07:29

Okay, it's been a while.

Anyway, I've changed all the paths in the scheme files, and everything else so they all point to the right paths.

But now, I'm still getting an error, and it's crashing.

This is the code:

Code: Select all

   CEGUI::SchemeManager::getSingleton().loadScheme(DEFAULT_DIR "TaharezLook.scheme");

   // create a window
   CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();

   CEGUI::Window* myRoot = wmgr.createWindow("DefaultWindow", "root");

   // Sets the passed window heirachy as the root (does not destroy the old one, just doesn't use it.
   // We can just switch between window heirachies by calling 'setGUISheet')
   CEGUI::System::getSingleton().setGUISheet(myRoot);

   // create a window of type FrameWindow using the "Taharez" widget set
   CEGUI::FrameWindow* fWnd = (CEGUI::FrameWindow*) wmgr.createWindow("TaharezLook/FrameWindow", "testWindow");

   // attatch the window to the heirachy we created above
   myRoot->addChildWindow(fWnd);

   // set the window's initial position and size
   fWnd->setPosition( CEGUI::Point(0.25f, 0.25f) );
   fWnd->setSize( CEGUI::Size(0.5f, 0.5f) );

   // set the caption of the window's title bar
   fWnd->setText("Hello World!");


The error is an access violation and happens on the line "wmgr.createWindow("TaharezLook/FrameWindow", "testWindow");".

Has this happened to anyone?

Or, conversly, I can use this code:

Code: Select all

    using namespace CEGUI;

    Imageset* taharezImages = ImagesetManager::getSingleton().createImageset(DEFAULT_DIR "imageset\\TaharezLook.imageset");
    System::getSingleton().setDefaultMouseCursor(&taharezImages->getImage("MouseArrow"));
    FontManager::getSingleton().createFont(DEFAULT_DIR "fonts\\Commonwealth-10.font");
    SchemeManager::getSingleton().loadScheme(DEFAULT_DIR "TaharezLookWidgets.scheme");
    WindowManager& winMgr = WindowManager::getSingleton();
    DefaultWindow* root = (DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");
    System::getSingleton().setGUISheet(root);
    FrameWindow* wnd = (FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Demo Window");
    root->addChildWindow(wnd);
    wnd->setMaximumSize(Size(1.0f, 1.0f));
    wnd->setMinimumSize(Size(0.1f, 0.1f));
    wnd->setText("Hello World!");
    wnd->setPosition(Point(0.25f, 0.25f));
    wnd->setSize(Size(0.5f, 0.5f));


And it won't crash, but I don't see a window or anything. I tried setting a translation of -5 on the z axis, which I thought wouldn't be necessary and didn't end up working anyway.

What's wrong (with either)?

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Sat Oct 28, 2006 10:02

I assume that you still create a Renderer and System first? Does the log show any non-fatal error or warning(s)?

Do the cegui samples look good on your system? Is the weirdness only showing up in your own code?


Return to “Help”

Who is online

Users browsing this forum: No registered users and 28 guests