Assertion failed

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

blablub
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Tue Mar 01, 2011 11:56

Assertion failed

Postby blablub » Wed Apr 06, 2011 11:18

I get an assertion failed error on line 73 in CEGUISingleton.h., but I'm using the OGRE singleton template. I wrote my own class that handles all the gui stuff (including CEGUI), which I instantiate once. Throughout the code there's also another non-CEGUI-related class using the Ogre singleton template (if this is important). I used the CEGUI tutorials to set the following up, which then creates the assertion failed...

Code: Select all

template<> Gui* Ogre::Singleton<Gui>::ms_Singleton = 0;

Gui& Gui::getSingleton()
{
    assert(ms_Singleton);
    return(*ms_Singleton);
}

Gui* Gui::getSingletonPtr()
{
    return ms_Singleton;
}

Gui::Gui()
{
    CEGUI::OgreRenderer& mRenderer = CEGUI::OgreRenderer::bootstrapSystem();
    CEGUI::System::create(mRenderer);

    rp = static_cast<CEGUI::DefaultResourceProvider*>
                (CEGUI::System::getSingleton().getResourceProvider());

    rp->setResourceGroupDirectory("schemes", GUI_PATH);
    rp->setResourceGroupDirectory("imagesets", GUI_PATH);
    rp->setResourceGroupDirectory("fonts", GUI_PATH);
    rp->setResourceGroupDirectory("layouts", GUI_PATH);
    rp->setResourceGroupDirectory("looknfeels", GUI_PATH);
    rp->setResourceGroupDirectory("lua_scripts", GUI_PATH);

    CEGUI::SchemeManager::getSingleton().create("MySkin.scheme");

    CEGUI::System::getSingleton().setDefaultMouseCursor("MySkin", "MouseArrow");
    CEGUI::System::getSingleton().setDefaultTooltip("MyTooltip");
    CEGUI::MouseCursor::getSingleton().setImage(
            CEGUI::System::getSingleton().getDefaultMouseCursor());
}


In the cpp I have:

Code: Select all

try
{
    Gui* myGui = new Gui();

    CEGUI::Window* sheet= CEGUI::WindowManager::getSingleton().loadWindowLayout("MyGame.layout");
    CEGUI::System::getSingleton().setGUISheet(sheet);
}
catch (CEGUI::Exception& e)
{
}

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Assertion failed

Postby Kulik » Wed Apr 06, 2011 11:58

Code: Select all

    CEGUI::OgreRenderer& mRenderer = CEGUI::OgreRenderer::bootstrapSystem();
    CEGUI::System::create(mRenderer);


You are creating CEGUI::System twice. bootstrapSystem already creates System for you. Remove the second line and all should be well.

blablub
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Tue Mar 01, 2011 11:56

Re: Assertion failed

Postby blablub » Wed Apr 06, 2011 14:30

Ah, thanks. Worked fine. :)

This wasn't completly clear in the tutorials to me.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Assertion failed

Postby Kulik » Wed Apr 06, 2011 17:50

Edit the tutorials so that it's more clear then please :-)


Return to “Help”

Who is online

Users browsing this forum: Bing [Bot] and 24 guests