home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / lang / sgl.lzh / EXAMPLES / EX3.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-12  |  1.3 KB  |  68 lines

  1. #include "gfunc.h"
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. void main()
  6.  
  7. {
  8.  int err0,err1,i;
  9.  double x[5],y[5];
  10.  
  11. /*********
  12.  * Figuren
  13.  *********/
  14.  err0 = initialize(0,0);                     /* Initialisierung        */
  15.  if (err0 == 0)
  16.  {
  17.   frame(300.0,210.0);                        /* Rahmen definieren      */
  18.   picture(300.0,210.0,0.0,0.0);              /* Bildbereich definieren */
  19.   err1 = mkwind();                           /* Fenster ÷ffnen         */
  20.   if (err1 != 0) exit(-1);
  21.   x[0] = 10.0;
  22.   y[0] = 10.0;
  23.   x[1] = 80.0;
  24.   y[1] = y[0];
  25.   x[2] = x[1];
  26.   y[2] = x[1];
  27.   x[3] = x[0];
  28.   y[3] = x[1];
  29.   x[4] = x[0];
  30.   y[4] = y[0];
  31.   setpat(3,NULL,0);
  32.   polyfill(5,x,y,6);
  33.   x[0] = x[1];
  34.   y[0] = y[1];
  35.   x[1] = x[0]+200.0*sin(45.0);
  36.   y[1] = y[0]+200.0*cos(45.0);
  37.   x[2] = x[1];
  38.   y[2] = y[1]+70.0;
  39.   x[3] = 80.0;
  40.   y[3] = 80.0;
  41.   x[4] = x[0];
  42.   y[4] = y[0];
  43.   setpat(2,NULL,0);
  44.   polyfill(5,x,y,2);
  45.   x[0] = 80.0;
  46.   y[0] = 80.0;
  47.   x[1] = x[2];
  48.   y[1] = y[2];
  49.   x[2] = x[1]-70.0;
  50.   y[2] = y[1];
  51.   x[3] = 10.0;
  52.   y[3] = 80.0;
  53.   x[4] = x[0];
  54.   y[4] = y[0];
  55.   setpat(1,NULL,0);
  56.   polyfill(5,x,y,10);
  57.   setpen(1);
  58.   setfont("ruby.font",15);
  59.   htext(150.0,195.0,"MB","Beispiel 3: Einfache Figuren");
  60.   finish();  
  61.  }
  62.  else
  63.  { 
  64.   printf("Fehler bei Initialisierung. (Fehler Nr. %d)\n",err0);
  65.   finish();
  66.  }
  67. }
  68.