game crashes when while loop used

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Guest

game crashes when while loop used

Post by Guest »

whenever i use a while loop the game crashes, BTW i am using Irrlicht....

I tried everthing, i don't understand why it crashes....

maybe i have to add someting when i use while loop... so if any1 knows how to implement a correct while loop to LOOp obviously when useing Irrlicht engine

Thanks
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

What are you using the while loop for?

If you're not using threads and stick a while loop in your code then it will halt the engine from rendering until the loop is finished.
Image Image Image
killzone721
Posts: 19
Joined: Thu Feb 09, 2006 1:45 am

Post by killzone721 »

what are threads and stick

you are correct that the while loop does halt the engine... i think stops the main loop:
driver->beginScene(...);
driver->end scene();

i am using a while loop for the timer... actually to jump

/////////////////////////////////////////////////////////////
while(now!=time that was set)
{
driver->beginScene(...); // i think this helps the engine to do on
jump;
reverse gravity
driver->end scene();
}
stop jump
put gravuty back on
///////////////////////////////////////////////

BUT IT STILL CARSHES

am i missing something
thanks
TO ALL THE AMATEURS OUT THERE LIKE ME......

AIM HIGH AND YOU MAKE SOMETHING PRETTY DECENT TO SHOW THE WORLD

CURRENTLY WORKING ON MY COMPANY WITH ME CREW MEMBERS. MY COMPANY IS CALLED
BIG DREAMS
AND WE ARE MAKE VERSION 0.1 FPS GAME
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Does it actually crash or just halt the program?

Because it seems that that would just stop everything until the time comes along, and the while loop will just stop EVERYTHING from happening, no rendering will be done, because everything's carried out sequentially.

You either need to introduce threads (allowing concurrent execution of different bits of code) or in the while(device->run()) loop do a check to see if the time has arrived, but not using a while loop.
Image Image Image
Guest = killzone721

Post by Guest = killzone721 »

well it just stops... but it doesn't work again.... actually the program doesn't respond anymore completely even after the time given in the while loop, it just doesn't respond anymore and i am force to ctrl + alt + del to end task the exe...

so i am not sure what to call it except crash

idea about check the time in the main loop... i tried that but it doesn't work for me and it makes the program extremely laggy...

i will keep on trying... and please keep on giving me ideas

THANKS
Post Reply