home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / VOGLE.ZIP / EXAMPLES / SIMPLE.C < prev    next >
C/C++ Source or Header  |  2000-02-11  |  1KB  |  64 lines

  1. #include <stdio.h>
  2. #include "vogle.h"
  3.  
  4. /*
  5.  * A program showing basic line drawing, text and (if applicable)
  6.  * colour. As none of the projection routines have been called we
  7.  * move and draw in the initial coordinate system -1.0 to 1.0.
  8.  */
  9. main(ac, av)
  10.     int    ac;
  11.     char    **av;
  12. {
  13.     char    device[10], *p;
  14.     float    cw, ch;
  15.  
  16.     fprintf(stderr,"Enter output device: ");
  17.     gets(device);
  18.  
  19.     prefsize(300, 300);
  20.     prefposition(100, 100);
  21.     vinit(device);        /* set up device */
  22.  
  23.     if (ac == 2)
  24.         font(av[1]);    /* change font to the argument */
  25.  
  26.     color(BLACK);        /* set current color */
  27.     clear();        /* clear screen to current color */
  28.  
  29.     color(GREEN);
  30.             /* 2 d move to start where we want drawstr to start */
  31.     move2(-0.9, 0.9);
  32.  
  33.     drawstr("A Simple Example 0 1 2 3 4 5 6 7 8 9");    /* draw string in current color */
  34.  
  35.     /*
  36.      * the next four lines draw the x 
  37.      */
  38.     move2(0.,0.);
  39.     draw2(.76,.76);
  40.     move2(0.,.76);
  41.     draw2(.76,0.);
  42.  
  43.     move2(0.0,0.5);
  44.     drawstr("x done");
  45.     drawstr("next sentence");
  46.  
  47.     move2(0.0,0.1);
  48.     for (p = "hello world"; *p != NULL; p++) 
  49.         drawchar(*p);        /* draw the string one char at a time */
  50.  
  51.     /*
  52.      * the next five lines draw the square
  53.      */
  54.     move2(0.,0.);
  55.     draw2(.76,0.);
  56.     draw2(.76,.76);
  57.     draw2(0.,.76);
  58.     draw2(0.,0.);
  59.  
  60.     getkey();        /* wait for some input */
  61.  
  62.     vexit();        /* set the screen back to its original state */
  63. }
  64.