The animation loop
The animation loop is shown in Listing 2.
Listing 2 contains a pair of nested while loops.
The outer loop continues to iterate until the user presses the Esc key, at which time the program terminates.
Listing 2. The animation loop.
while(!key[KEY_ESC]){ while(mouseInfo(&xCoor,&yCoor,&color)){ //Draw while mouse button is down. draw(xCoor,yCoor,screenBuf,color); }//end while }//end while return 0; }//end main END_OF_MAIN(); |