Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Homework

Name: 2009-08-18 10:35

Output a thousand Sussmen in an individualistic way.

Name: Anonymous 2009-08-18 11:53

/* gcc sussman.c `allegro-config --libs` */

#include <stdio.h>
#include <allegro.h>

#define WIDTH 1280
#define HEIGHT 800

int main(int argc, char **argv)
{
    BITMAP *sussman;
    PALETTE pal;
    int i, j;

    if (argc < 2) {
        fprintf(stderr, "%s SUSSMAN.bmp\n", argv[0]);
        return 1;
    }

    allegro_init();
    install_keyboard();

    if (set_gfx_mode(GFX_AUTODETECT, WIDTH, HEIGHT, 0, 0) != 0)
        return 2;

    sussman = load_bitmap(argv[1], pal);
    set_palette(pal);

    for (i = 0; i < WIDTH / sussman->w; ++i)
        for (j = 0; j < HEIGHT / sussman->h; ++j)
            draw_sprite(screen, sussman, i * sussman->w, j * sussman->h);

    destroy_bitmap(sussman);
    while (!keypressed());

    return 0;
} END_OF_MAIN()


Just pass it a suitable small bitmap of the Sussman as a parameter. I suggest this one:
http://cairnarvon.rotahall.org/pics/sussman_tiny.bmp

(At that resolution, that will actually output 2560 Sussmen.)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List