Quote:
Originally Posted by Da_sk8rboy
could you explain exactly what the loop is doing.. (im fairly new to C++) havent got to loops yet..
|
Well, you should probably know that main is, by name, your main function. It's the control center of your program. And once that function ends, you're done. So, what if you want to continually do an action? The way to do this is an a for/while loop. FYI, loops are pretty much the same as they are in pawn (for the most part).
Code:
void main(void)
{
bool quit = false; // Don't forget you _must_ initiliaze variables in C++. Or
// you'll get an error or a program crash.
while (!quit)
{
// Let's say we're running a game.
gMyEngine->UpdateGraphics();
gMyEngine->ClearServerMessages();
// etc.
if (!Blabla())
quit = true; // Stop execution
}
// Do ending stuff right here.
gMyEngine->ClearMemory();
}
There are some other ways you can do this to:
Code:
while (1)
{
if (yar)
break;
}
__________________