Listing 5. The animation loop.
  //Seed the random number generator and set the initial
  // direction based on a random number.
  srand (time(NULL));
  dir = rand() % 4;
  
  //Loop until the user presses the Esc key.
  while( !key[KEY_ESC]){
    moveBall();
  }//end while loop

  return 0;
}//end main
END_OF_MAIN();