Hello community,
I was just looking through the CEGUI tutorial by Laurens and the CEGUI forums for an answer to this little frustrating issue but all to no avail.
Essentially the problem is that I keep getting an access violation when I run the program and I'm pretty sure I narrowed it down to the line thats causing the exception.
CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
Now, I have a the TaharezLook.scheme in my gui/schemes folder which is in the main folder of my application.
I'm using Visual Studio 2010 with the 09 toolset. I've followed the tutorial to a T and have crosschecked my code to it a million times.
When checking the CEGUI log file it returns no error. Heres my log.
So I'm rather confused at there being no error in the log for this...
I've posted my code below, I left out a lot of the usual leadwerks code in my program but left my comments. Essentially the program stops getting the access violation when the CEGUI code is removed, and when commenting out the aforementioned line I get no crash, but then obviously the GUI doesnt render.
#include "engine.h"
#include "CEGUI.h"
#include "RendererModules\OpenGL\CEGUIOpenGLRenderer.h"
#include "ProcessScene.h"
int main(int argc, char** argv)
{
Initialize();
//Create a graphics context
Graphics(1024,768);
//Create a world
if (!CreateWorld())
{
MessageBoxA(0,"Error","Failed to create world.",0);
goto exitapp;
}
//Create a camera
//Create a light
//Load Scene
//Create a render buffer
//Configure Character
//Reposition Camera
//Handle Collisions
//Camera & Movement Variables
//Init GUI
CEGUI::OpenGLRenderer &ceguiRenderer = CEGUI::OpenGLRenderer::create();
CEGUI::System::create(ceguiRenderer);
ceguiRenderer.enableExtraStateSettings(true);
CEGUI::DefaultResourceProvider *rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());
rp->setResourceGroupDirectory("schemes", "gui/Schemes/");
rp->setResourceGroupDirectory("layouts", "gui/Layouts/");
rp->setResourceGroupDirectory("looknfeels", "gui/LookNFeels/");
rp->setResourceGroupDirectory("imagesets", "gui/Imagesets/");
rp->setResourceGroupDirectory("fonts", "gui/Fonts/");
CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
CEGUI::Imageset::setDefaultResourceGroup("imagesets");
CEGUI::Font::setDefaultResourceGroup("fonts");
CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
CEGUI::FontManager::getSingleton().create( "DejaVuSans-10.font" );
CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10");
CEGUI::WindowManager &wm = CEGUI::WindowManager::getSingleton();
CEGUI::Window *root = wm.loadWindowLayout("test.layout");
CEGUI::System::getSingleton().setGUISheet(root);
//Main loop
while(!KeyHit(KEY_ESCAPE))
{
//Camera Controls
//Character Controls
//Update the world
UpdateAppTime();
UpdateWorld();
//Render the scene
SetBuffer(buffer);
RenderWorld();
//Render lighting
SetBuffer(BackBuffer());
RenderLights(buffer);
//GUI Render
glPixelStoref(0x806E, 0);
glPixelStoref(GL_PACK_ROW_LENGTH, 0);
glPixelStoref(GL_UNPACK_ROW_LENGTH, 0);
CEGUI::System::getSingleton().renderGUI();
Flip();
}
exitapp:
Terminate();
return 0;
}
If you need any more information from me please let me know.
Thanks in advance =).