I am fairely new to irrlicht and I have a problem which I cant understand. Starting from Tutorial Example 4, I wanted to put the gui example in a proper window-class. So I seperated the while-loop for drawing the window from the definition. This somehow messed everything up. After some try and error, I seem to have identified the problem: it is not possible to call "createDevice" in the constructor of a class and use the returning device instance in an other function. I guess its a local variable that gets out of scope as soon as the constructor is left. Example:
Code: Select all
TestGUI::TestGUI()
{
this->device = createDevice(video::EDT_OPENGL, core::dimension2d<u32>(640, 480), 32, false, false, false, this);
...
}
void TestGUI::runGUI()
{
while(this->device->run())
{
...
}
}
Code: Select all
TestGUI test = TestGUI();
test.runGUI();
edit: solved