Some more light reading for you:
A simple game is roughly constructed from the following parts:
The main loop in turn has three distinct parts:
(In my last post I merged "input" and "processing" into "logic".)
Since you decided to use Allegro you can create everything listed above entirely with only functions this library provides (even though many people choose to use more specialized libraries for certain tasks). The processing part can (and should) actually be done without Allegro completely.
1. Initialization: This is a very simple task. You only call a few of the Allegro functions from the first couple of chapters of the Allegro manual and check their return values (to make sure all is working properly). The chapters of the Allegro manual you must read are: "Using Allegro", "Configuration Routines" and "Graphics Modes". You should also take a look at the functions whose name is in the format "install_something" in chapters "Mouse routines", "Timer routines", "Keyboard routines", "Joystick routines" and "Sound init routines".
2. Loading and preparing data: Here you will load bitmaps, samples, fonts, music files, levels, maps, etc. You will also create an off screen buffer for your double buffering system here. You will use functions from these Allegro chapters: "Bitmap objects", "Loading image files", "Fonts", "Digital sample routines", "Datafile routines" and perhaps several others. You will mostly call functions named something like "load_something" and "create_something". Again you will check the return values to make sure everything went fine.
3. The main loop: This is a while loop that potentially runs forever. You only break from this loop when it is time to close the program (as a response to user input). In the main loop you have three parts that are executed over and over again: input, processing and output. The code must be structured in such a way that input and processing are executed a fixed number of times each second while output can run slower (or faster if you so wish). You can accomplish this by using functions from the chapter titled "Timer routines".
3.1. Input: Here you gather player input. You check for the status of the keyboard, mouse and/or joystick(s). (In some more advanced games you would also gather incoming network data here). You should do all this with just the Allegro functions from chapters "Mouse routines", "Keyboard routines" and "Joystick routines".
3.2. Processing: More often than not you can do this step with no Allegro functions whatsoever. In fact I think you shouldn't use any at all here. All you need for processing are the programming constructs built into the languages of C and C++. Very often you will also use the part of the standard C library that you get access to by including "math.h". You should especially avoid using Allegro functions that deal with graphics in this step (getpixel is one such function you should not use). Note: You should probably ignore the chapters from the end of the Allegro manual that deal with math.
3.3. Output: This will be the beefy part of the game. Here you will use the most powerfull parts of Allegro: "Drawing primitives", "Blitting and sprites", "Text output", "Polygon rendering", "Transparency and patterned drawing", "Digital sample routines" and "Music routines (MIDI)". You will draw your game world to the screen and play samples and music. You will not do any input gathering or processing here.
4. Cleaning up: Here you just free all memory and exit.
Once you implement your game in this way, you will have a solid system that will work the first time and you can easily add to and build upon as you learn new tricks.