Discussion and sample code

Will explain this program in fragments.

The fragment in Listing 1 shows the include directive along with the beginning of the main function.

Listing 1. Beginning of the main function.
#include <allegro.h>

int main(){
  int x = 20,y = 30;//position coordinates for text

  allegro_init();//Allegro initialization
  install_keyboard();//Set up for keyboard input

  //Set the graphics mode to a 320x240-pixel window.
  set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320,240,0,0);