Page 1 of 2
Crash on getSingleton
Posted: Tue Apr 10, 2007 19:23
by danharibo
Code: Select all
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
Just causes an assertion error. What the hell
mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
CEGUI::WindowManager* mGUImngr = new CEGUI::WindowManager();
mGUISystem = new CEGUI::System(mGUIRenderer);
mEditorGuiSheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "root");
CEGUI::System::getSingleton().setGUISheet(mEditorGuiSheet);
Posted: Tue Apr 10, 2007 20:47
by Levia
Dont instantiate the WindowManager, the System constructor does that for you.
Code: Select all
mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
mGUISystem = new CEGUI::System(mGUIRenderer);
mEditorGuiSheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "root");
CEGUI::System::getSingleton().setGUISheet(mEditorGuiSheet);
Posted: Tue Apr 10, 2007 21:04
by danharibo
Still Crashes.
Posted: Tue Apr 10, 2007 21:11
by Levia
Can you specify on what line it crashes? Perhaps the System is not created properly.
Posted: Tue Apr 10, 2007 21:20
by danharibo
It Crashes here:
Code: Select all
Cbaseeditor* mEditor = new Cbaseeditor(mSceneMgr,CEGUI::WindowManager::getSingleton().getWindow("root"));
According to the debugger, but i'm guessing this is the cause:
Code: Select all
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
Posted: Tue Apr 10, 2007 21:27
by Levia
Where is that line then? I mean, can you paste some more code?
Posted: Tue Apr 10, 2007 21:31
by danharibo
Code: Select all
void Cbaseeditor::DrawMenu()
{
////Grab the CEGUI Window Manager
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
//Draws a CEGUI driven MENU.
CEGUI::PushButton* SaveButton = (CEGUI::PushButton*)wmgr.createWindow("TaharezLook/Button", (CEGUI::utf8*)"Save");
mEditorGuiSheet->addChildWindow(SaveButton);
SaveButton->setPosition(CEGUI::UVector2(cegui_reldim(0.35f), cegui_reldim( 0.45f)));
SaveButton->setSize(CEGUI::UVector2(cegui_reldim(0.35f), cegui_reldim( 0.1f)));
SaveButton->setText("Save");
//Register Events for said elements
SaveButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&Cbaseeditor::SaveMap,this));
}
but it crashes at the constructor, when it tries to getSingleton for the windowManager
Posted: Tue Apr 10, 2007 21:37
by Levia
Are you sure you call new CEGUI::System before you call that getSingleton for the windowmanager?
Try
Code: Select all
CEGUI::WindowManager * mWndMgr = CEGUI::WindowManager::getSingletonPtr();
aswell.
Can you show me the constructor of that class?
Posted: Wed Apr 11, 2007 12:42
by danharibo
Code: Select all
Cbaseeditor* mEditor = new Cbaseeditor(mSceneMgr,CEGUI::WindowManager::getSingletonPtr()->getWindow("root"));
Still Crashes here!
Code: Select all
Cbaseeditor::Cbaseeditor(Ogre::SceneManager* temp,CEGUI::Window* mGuiRoot)
{
//Save the SceneMgr
mSceneMgr = temp;
Verstring = "Version 0.1.1a";
Ogre::LogManager::getSingleton().logMessage("-----------------------");
Ogre::LogManager::getSingleton().logMessage("-- Cbaseeditor --------");
Ogre::LogManager::getSingleton().logMessage("Version: "+Verstring);
Ogre::LogManager::getSingleton().logMessage("-- Initalizing Editor -");
Ogre::LogManager::getSingleton().logMessage("-----------------------");
//Load the Objects
LoadResOdef();
mEditorGuiSheet = mGuiRoot;
//Show the load map Gui
DrawMenu(); //We need this to Load our Main GUI
}
Posted: Wed Apr 11, 2007 13:05
by Levia
Ok, are you sure CEGUI::System is created? Are there errors in the cegui.log?
Posted: Wed Apr 11, 2007 13:29
by danharibo
05/04/2007 14:46:57 (InfL1) Attempting to create Font from the information specified in file 'bluehighway-12.font'.
05/04/2007 14:46:57 (Error) Exception: FontManager::createFont - The value for the Font:Type attribute 'Dynamic' is unknown.
05/04/2007 14:46:57 (Error) FontManager::createFont - loading of Font from file 'bluehighway-12.font' failed.
And I'm pretty sure System is being created
Posted: Wed Apr 11, 2007 13:31
by Levia
Are you sure that exception isnt causing CEGUI to crash? Where are you creating the font? Are you sure the font file is there? Make sure the font loads correctly as most windows need it
Posted: Wed Apr 11, 2007 13:54
by danharibo
It Doesn't make sense because the font type is "FreeType"
Posted: Wed Apr 11, 2007 14:01
by Levia
Try another font..some standard font..?
Posted: Wed Apr 11, 2007 15:27
by danharibo
Ok i think it's working. but it still crashes. I'll have to get back to this as something more important has come up..