I keep getting a segmentation fault and I have traced it to the addToolbar line in my code. I see no reason as to why this should be happening but it is. Here is my createGUI() function from my GUI class, the GUIEnviroment is initialized in the GUI class constructor. Please ignore all the printf()'s as those were to help me locate where the problem was occuring.
Code: Select all
void Gui::createGUI(void)
{ printf("Creating GUI..\n"); //last printf to execute
IGUIToolBar* bar = env->addToolBar(); //This is where the problem must be occuring
printf("Toolbar Created..\n");
env->addStaticText(L"Constant Path: ", core::rect<s32>(8,10,90,25), false);
IGUIEditBox* namebox = env->addEditBox(L"Test/X", core::rect<s32>(100,8,240,25), true, bar, 901);
printf("Const. Path Box Created..\n");
env->addStaticText(L"Start#:", core::rect<s32>(250,10,300,25), false);
IGUIEditBox* range1box = env->addEditBox(L"1", core::rect<s32>(310,8,350,25), true, bar, 902);
printf("Range1 Box Created..\n");
env->addStaticText(L"End#: ", core::rect<s32>(360,10,410,25), false);
IGUIEditBox* range2box = env->addEditBox(L"1", core::rect<s32>(420,8,470,25), true, bar, 903);
printf("Range2 Box Created..\n");
IGUICheckBox* sphere_check_box = env->addCheckBox (true,core::rect<s32>(490,8,510,25) , bar, 400, L"Spheres");
IGUICheckBox* box_check_box = env->addCheckBox (false,core::rect<s32>(530,8,550,25), bar, 400, L"Boxes");
printf("Check Boxes Created..\n");
IGUIButton* launchbutton = env->addButton(core::rect<s32>(570,8,600,25), bar, 1101, L"Launch");
printf("Launch Button Created..\n");
fpstext = env->addStaticText(L"", core::rect<s32>(850,8,900,25), true);
timetext = env->addStaticText(L"", core::rect<s32>(910,8,1010,25), true);
frametext = env->addStaticText(L"", core::rect<s32>(1020,8,1150,25), true);
printf("Static Text's Created..\n");
IGUIButton* helpbutton = env->addButton(core::rect<s32>(1750,8,1790,25), bar, 1102, L"Help");
IGUIButton* prefbutton = env->addButton(core::rect<s32>(1650,8,1740,25), bar, 1103, L"Preferences");
printf("Help and Pref. Buttons Created..\n");
IGUISkin* skin = env->getSkin();
printf("Got Skin..\n");
IGUIFont* font = env->getFont("../include/fonthaettenschweiler.bmp");
printf("Got Font..\n");
skin->setFont(font);
printf("Font Set..\nBeginning Alpha Loop\n");
for (s32 k=0; k<gui::EGDC_COUNT ; ++k)
{
SColor col = env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)k);
col.setAlpha(255);
env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)k, col);
}
printf("Alpha Loop Finshed..\n");
stringw capstr = L"Visualization";
device->setWindowCaption(capstr.c_str());
printf("Window Caption Set..\nGUI Finished\n");
}