Subversion Repositories programming

Rev

Rev 292 | Rev 297 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*******************************************************************************
 * ggitest.c - a simple test of the draw library
 *
 * Copyright (c) 2006, Ira W. Snyder (devel@irasnyder.com)
 ******************************************************************************/

#include <stdio.h>
#include "draw.h"

int main ()
{
    int i;

    /* Initialize */
    draw_init ();

    /* Use */
    draw_clearscreen ();
    draw_putpixel (20, 20, RED);
    draw_box (50, 50, 100, 100, GREEN);
    draw_line (30, 20, 300, 180, BLUE);
    draw_box (100, 80, 100, 100, WHITE);

    sleep (5);

    draw_clearscreen ();
    draw_putpixel (40, 40, RED);
    draw_putpixel (20, 20, GREEN);
    draw_putpixel (30, 30, BLUE);
    
    sleep (5);

    /* Slow draw */
    draw_clearscreen ();

    for (i=0; i<800; i++)
    {
        draw_putpixel (i, i, RED);
        usleep (10000);
    }

    /* text output */
    draw_clearscreen ();

    draw_putc (0, 0, 'i', RED);
    draw_putc (20, 20, 'r', GREEN);
    draw_putc (40, 40, 'a', BLUE);

    draw_puts (60, 60, "rocks", GREEN);

    sleep (5);

    /* Quit */
    draw_close ();

    return (0);
}