Discussion and sample code

Will explain the program code in fragments.

Complete listing in Listing 5.

First fragment in Listing 1.

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

int main(){
  //Typical Allegro setup.
  allegro_init();
  install_keyboard();
  set_color_depth(32);
  //Create an onscreen window 332x651 pixels in size.
  set_gfx_mode(GFX_AUTODETECT_WINDOWED,332,651,0,0);

You have seen the code in Listing 1 in earlier lessons.