closing the window
closing the window
Is there any way to put some code to do something when the user close the window, especifically when he press the x button i have a loop but i want that when the user press the x button to close it a method end the loop is there any way to do it if it you have an example or something
Yes, IrrlichtDevice::run() returns false when the device wishes to close (when the user presses X), so if you have code like so, you need only add code to the end of the loop:
Code: Select all
while ( Device->run() )
{
// Main Loop
}
// Code here will happen when the device is closed
i had it a little bit different
Code: Select all
while(device->run() && resultado !=50){
//press esc
// resultado == 50
}
Well, as long as you just want the window to close when resultado != 50, you could do this:
Code: Select all
while( device->run() )
{
//press esc
// resultado == 50
if ( resultado !=50 )
device->closeDevice() ;
}
// on quit
XDD
i havent thought about that possibility once you see it you feel really dumb thanks
bad new i have tried and it doesnt work
i have a class could called de main class that pass de device as a aparameter to do other things the problem is if i close the window running the second class comes up an error if i close the program in the main class the program close right
editing for thirth time
i finally solve it thank for your advices they help me a lot thanks
bad new i have tried and it doesnt work
i have a class could called de main class that pass de device as a aparameter to do other things the problem is if i close the window running the second class comes up an error if i close the program in the main class the program close right
editing for thirth time
i finally solve it thank for your advices they help me a lot thanks