Discussion and sample code

I will explain this program in fragments.

A complete listing of the program is provided in Listing 10.

Listing 1 shows the beginning of the program including material that you have learned about in earlier lessons.

Listing 1. Beginning of the program.
#include <allegro.h>;

int main(){
  //Do the preliminaries.
  allegro_init();
  install_keyboard();

  set_gfx_mode(GFX_AUTODETECT_WINDOWED,400,400,0,0);