Introduction to Computer Science

trygraphics.c

Note: Use your mouse to cut and paste this into emacs!

/*
 * File: trygraphics.c
 * -------------
 *  Eric Siegel testing graphics
 */

#include <stdio.h>
#include "genlib.h"
#include "simpio.h"
#include "graphics.h"

main()
{
    double cx, cy;     /* center of window */
    double x, height;

    InitGraphics();
    SetPenColor("Blue");

    cx = GetWindowWidth() / 2;    /* center of x-axis */
    height = GetWindowHeight();   /* window height */
    cy = height / 2;              /* center of y-axis */

    /* Draw an upside-down triangle */
    for(x = -cx; x < cx; x = x + .01) { /* Change the increment to .05 */
        MovePen(cx,0);                  /* for a cool effect!          */
	DrawLine(x,height);
    }

    /*
    MovePen(cx,cy);
    DrawArc(1, 0, 350);
    */
}

email: evs at cs dot columbia dot edu