Im having a little problem with a seg fault here.. and neither me, nor the debugger can seem to find it, just that it's there..
Now i just started a new Irrlicht project, and i put everything in like normal.. setup a class to read from the XML config file.. then create the device.. etc.. all worked fine.. i went ahead and added a class to manage my game states (like game init functions that do nothing at the moment, scene managers that manage nothing, etc.)
mostly it's just like a skeleton i will fill in later... regardless, everything works fine and when i CLOSE the window it hits a segfault.. so im thinking it might be with something not dying like it should be..
Code: Select all
while(device->run())
{
if(rpg->getInitState() == 1)
rpg->switchScene(0); // Main Menu
if(rpg->needChange() == 1)
rpg->switchScene(rpg->getSceneNum()); // Run Current Scene
driver->beginScene(true, config.ZBUFFER, SColor(0,200,200,200));
smgr->drawAll();
genv->drawAll();
driver->endScene();
}
device->drop();however, i did go ahead and add in for realtime restarts if needed (or whatever you call it when you want the user to edit the configuration from a panel IN GAME and then the game restarts itself basically with the new settings)
and this is all done with a do while loop.
Code: Select all
// include headers
int main()
{
// init the classes
IrrlichtDevice *device = 0;
EventHand *handle = new EventHand;
RPGDevice *rpg;
// etc.
do
{
// parse the XML using a function that uses the IXML features, ive used this exact class in a previous project and it worked there with no problems.
//create the device using the configurations, the window DOES create when the project runs so this most likely works correct as it changes correctly according to the config.xml file
device->setEventReciever(handle);
handle->setDevice(device);
rpg->beginDevice(device);
while(device->run())
{
// check what is posted above for this loop
}
device->drop();
restart = rpg->getRestart();
} while(restart == 1);
delete handle;
return 0;
}Code: Select all
beginDevice(...)
{
device = dev;
scenenum = 0;
// more variables with values reset to whatever i need them to be.
}if you guys need more i can post it.. since im not that far in i could just rewrite it again and compile more often to find the seg fault but id rather not if you all can see something.
Thank you in advance,
-Coolkat
