Allegro/Szkielet programu w Allegro

Z Wikibooks, biblioteki wolnych podręczników.
#include <allegro5/allegro.h>

int main() {
    // Initialize Allegro
    al_init();

    // Create a window
    ALLEGRO_DISPLAY *display = al_create_display(640, 480);

    // Run the game loop
    while (true) {
        // Handle events
        ALLEGRO_EVENT event;
        if (al_get_next_event(display, &event)) {
            // Handle event
        }

        // Update game state

        // Draw to screen
        al_clear_to_color(al_map_rgb(0, 0, 0)); // clear screen to black
        // Draw sprites, backgrounds, etc.

        al_flip_display(); // swap the back buffer to the front
    }

    // Cleanup
    al_destroy_display(display);

    return 0;
}

Ten program inicjuje Allegro, tworzy okno i wchodzi w pętlę gry, w której obsługuje zdarzenia, aktualizuje stan gry i rysuje na ekranie. W tym programie szkieletowym, obsługa zdarzeń i aktualizacja stanu gry są puste, ponieważ będą one zależeć od specyfiki twojej gry.