/*
  a simple program using the vogle library for graphical display,
  adapted from examples/simple.c and examples/poly.c

  Wes Huang
  1/21/01 
*/
#include <stdio.h>

// eventually this file should be in /usr/local/include, but for now,
// you'll have to put it somewhere such as in your current directory.
extern "C" {
#include "vogle.h"  
}

float obst1[][2] = {
  { 20, 25 },
  { 114, 65},
  { 100, 80},
  { 10, 70}
};


float obst2[][2] = {
  { -50, -100},
  { -75, -25},
  { -25, -75}
};

float obst3[][2] = {
  { -50, 100},
  { -75, 25},
  { -25, 125}
};

int main(int ac, char* av[])
{
  float	cw, ch;

  // initialize vogle
  vinit("X11");

  color(BLACK);		/* set current color */
  clear();		/* clear screen to current color */
  ortho(-200.0, 200.0, -200.0, 200.0, 200.0, -200.0);

/*    color(YELLOW); */
/*    poly(4, parray); */

  color(GREEN);

  // draw a polygon
  poly2(4, obst1);

  // draw a filled polygon
  polyfill(1); // turn on polygon filling
  poly2(3, obst2);

  // draw a hatched polygon
  polyhatch(1); // turn on polygon hatching
  hatchang(45.0);
  hatchpitch(5.0); // how close the hatching lines are
  poly2(3, obst3);
    
  // draw some lines
  //
  // you need to specify the "." to get floating point numbers here
  // because the include file doesn't contain type declarations for
  // the arguments!
  //
  move2(0.,0.); 
  draw2(50.,-50.);

  move2(75.,-75.);
  draw2(125.,-75.);
  draw2(125.,-100.);
  draw2(75.,-100.);
  draw2(75.,-75.);

  getkey(); // wait for a keypress in the window

  vexit();
}
