I am a tad new to the CEGUI world, but have been programming C++ for quite a while. I am presently working on a game project utilizing an OpenGL-based Renderer (Leadwerks Engine).
I have been attempting to implement CEGUI, but am continuously held up by crashes that exist regardless of whether I compile in Debug, Release, or static variants thereof. Also, even when using the debug libraries, no symbols are ever loaded into the call stack, and I have to trace through disassembly and breakpoints to determine the cause.
This is the code of my class that is causing the issue:
Code: Select all
#include "CUIManager.h"
bool CUIManager::Initialize()
{
// GUI
try
{
mRenderer = new CEGUI::OpenGLRenderer(1024, 800, 600);
mSystem = new CEGUI::System(mRenderer);
//using CEGUI::UVector2;
//glPixelStoref(0x806E, 0); // GL_UNPACK_IMAGE_HEIGHT
//glPixelStoref(GL_PACK_ROW_LENGTH, 0);
//glPixelStoref(GL_UNPACK_ROW_LENGTH, 0);
// initialise the required dirs for the DefaultResourceProvider
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 to be used
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 in the scheme file, which auto-loads the TaharezLook imageset
CEGUI::SchemeManager::getSingleton().loadScheme( "TaharezLook.scheme" );
// load in a font. The first font loaded automatically becomes the default font.
//if(! CEGUI::FontManager::getSingleton().isFontPresent( "Commonwealth-10" ) )
// CEGUI::FontManager::getSingleton().createFont( "Commonwealth-10.font" );
mSystem->setDefaultFont( "Commonwealth-10" );
mSystem->setDefaultMouseCursor( "TaharezLook", "MouseArrow" );
mSystem->setDefaultTooltip( "TaharezLook/Tooltip" );
mWindowManager = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window* myRoot = mWindowManager->createWindow( "DefaultWindow", "root" );
mSystem->setGUISheet( myRoot );
CEGUI::FrameWindow* fWnd = (CEGUI::FrameWindow*)mWindowManager->createWindow( "TaharezLook/FrameWindow", "testWindow" );
myRoot->addChildWindow( fWnd );
// position a quarter of the way in from the top-left of parent.
fWnd->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.25f, 0 ), CEGUI::UDim( 0.25f, 0 ) ) );
// set size to be half the size of the parent
fWnd->setSize( CEGUI::UVector2( CEGUI::UDim( 0.5f, 0 ), CEGUI::UDim( 0.5f, 0 ) ) );
fWnd->setText( "Hello World!" );
}
catch(CEGUI::Exception & e)
{
printf("CEGUI Error: %s\n", e.getMessage().c_str());
return false;
}
return true;
}
void CUIManager::Render()
{
//glPixelStoref(0x806E, 0); // GL_UNPACK_IMAGE_HEIGHT
//glPixelStoref(GL_PACK_ROW_LENGTH, 0);
//glPixelStoref(GL_UNPACK_ROW_LENGTH, 0);
mSystem->renderGUI();
}
I have traced the problem, via breakpoints, to occuring at/after:
Code: Select all
CEGUI::SchemeManager::getSingleton().loadScheme( "TaharezLook.scheme" );
The exception is an Access Violation Exception. My CEGUI Log, which also remains the same regardless of compile setting, is:
Code: Select all
25/08/2009 18:12:44 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25/08/2009 18:12:44 (Std) + Crazy Eddie's GUI System - Event log +
25/08/2009 18:12:44 (Std) + (http://www.cegui.org.uk/) +
25/08/2009 18:12:44 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25/08/2009 18:12:44 (Std) CEGUI::Logger singleton created. (003846C0)
25/08/2009 18:12:44 (Std) ---- Begining CEGUI System initialisation ----
25/08/2009 18:12:44 (Std) CEGUI::ImagesetManager singleton created (00385B68)
25/08/2009 18:12:44 (Std) CEGUI::FontManager singleton created. (00385E40)
25/08/2009 18:12:44 (Std) CEGUI::WindowFactoryManager singleton created
25/08/2009 18:12:44 (Std) CEGUI::WindowManager singleton created (00386228)
25/08/2009 18:12:44 (Std) CEGUI::SchemeManager singleton created. (003862A0)
25/08/2009 18:12:44 (Std) CEGUI::MouseCursor singleton created. (00385418)
25/08/2009 18:12:44 (Std) CEGUI::GlobalEventSet singleton created. (00385598)
25/08/2009 18:12:44 (Std) CEGUI::WidgetLookManager singleton created. (003856E8)
25/08/2009 18:12:44 (Std) CEGUI::WindowRendererManager singleton created (00385960)
25/08/2009 18:12:44 (Std) WindowFactory for 'DefaultWindow' windows added. (588B75C8)
25/08/2009 18:12:44 (Std) WindowFactory for 'DragContainer' windows added. (588B7988)
25/08/2009 18:12:44 (Std) WindowFactory for 'ScrolledContainer' windows added. (588B70B0)
25/08/2009 18:12:44 (Std) WindowFactory for 'ClippedContainer' windows added. (588B7848)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Checkbox' windows added. (588B7488)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/PushButton' windows added. (588B7C08)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/RadioButton' windows added. (588B7CA8)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Combobox' windows added. (588B6F68)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/ComboDropList' windows added. (588B7DE8)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Editbox' windows added. (588B6E28)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/FrameWindow' windows added. (588B72A8)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/ItemEntry' windows added. (588B7528)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Listbox' windows added. (588B7D48)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/ListHeader' windows added. (588B7F28)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/ListHeaderSegment' windows added. (588B7008)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Menubar' windows added. (588B7E88)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/PopupMenu' windows added. (588B7348)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/MenuItem' windows added. (588B6B00)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/MultiColumnList' windows added. (588B7208)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/MultiLineEditbox' windows added. (588B7B68)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/ProgressBar' windows added. (588B7708)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/ScrollablePane' windows added. (588B78E8)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Scrollbar' windows added. (588B6EC8)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Slider' windows added. (588B77A8)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Spinner' windows added. (588B73E8)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/TabButton' windows added. (588B7AC8)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/TabControl' windows added. (588B7168)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Thumb' windows added. (588B6CE0)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Titlebar' windows added. (588B6C40)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Tooltip' windows added. (588B6BA0)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/ItemListbox' windows added. (588B7A28)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/GroupBox' windows added. (588B6D88)
25/08/2009 18:12:44 (Std) WindowFactory for 'CEGUI/Tree' windows added. (588B7668)
25/08/2009 18:12:44 (Std) Window type alias named 'DefaultGUISheet' added for window type 'DefaultWindow'.
25/08/2009 18:12:44 (Std) CEGUI::System singleton created. (00384140)
25/08/2009 18:12:44 (Std) ---- CEGUI System initialisation completed ----
25/08/2009 18:12:44 (Std) ---- Version 0.6.2 ----
25/08/2009 18:12:44 (Std) ---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based renderer module for CEGUI ----
25/08/2009 18:12:44 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
25/08/2009 18:12:44 (Std) ---- Scripting module is: None ----
25/08/2009 18:12:44 (Std) Attempting to load Scheme from file 'TaharezLook.scheme'.
25/08/2009 18:12:44 (Std) Attempting to create an Imageset from the information specified in file 'TaharezLook.imageset'.
25/08/2009 18:12:44 (Std) Started creation of Imageset from XML specification:
25/08/2009 18:12:44 (Std) ---- CEGUI Imageset name: TaharezLook
25/08/2009 18:12:44 (Std) ---- Source texture file: TaharezLook.tga in resource group: (Default)
I also found that I have to import additional libraries to even get the program to compile, that I didn't see in the example/sample projects. My final dependency list is:
Code: Select all
winmm.lib
freetype_d.lib
glu32.lib
opengl32.lib
freeglut_d.lib
pcre_d.lib
CEGUIBase_d.lib
CEGUIExpatParser_d.lib
expat_d.lib CEGUITGAImageCodec_d.lib
CEGUISILLYImageCodec_d.lib
SILLY_d.lib
CEGUIDevILImageCodec_d.lib
CEGUIFreeImageImageCodec_d.lib
CEGUICoronaImageCodec_d.lib
OpenGLGUIRenderer_d.lib
CEGUITinyXMLParser_d.lib
CEGUIXercesParser_d.lib
CEGUIFalagardWRBase_d.lib
The above is debug, and if in static mode I just define CEGUI_STATIC and swap to the "_Static" libraries.
And in Release:
Code: Select all
winmm.lib
opengl32.lib
glu32.lib
freetype.lib
pcre.lib
CEGUIBase.lib
CEGUIExpatParser.lib
expat.lib
CEGUITGAImageCodec.lib
CEGUISILLYImageCodec.lib
SILLY.lib
CEGUIDevILImageCodec.lib
CEGUIFreeImageImageCodec.lib
CEGUICoronaImageCodec.lib
OpenGLGUIRenderer.lib
CEGUIFalagardWRBase.lib
Again, I have no idea why this is occuring, I assume it could possibly be something with XML, because a few days ago in initial tests, there were 1 or 2 symbols for XML Calls, but they were fixed by linking the XML module libraries.
To note, I am using the Visual Studio 2008 Professional IDE, with MSVC++ 9.0 Compiler. I am using the 2008/9.0 binary pack for the libraries of CEGUI.
I would appreciate any help at all, as this is the only thing holding up development progress.
Many Thanks,
Tyler Harden
