home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / logo / part01 / gigi.i < prev    next >
Encoding:
Text File  |  1987-06-23  |  2.1 KB  |  107 lines

  1.  
  2. /* Include file for turtle.c for GIGI */
  3.  
  4. int gigiturt(),gigifrom(),gigito(),gtcheck(),gpenc(),gstate();
  5. struct display gigi ={0.0,0.0,0.0,-384.0,383.0,-240.0,239.0,0.8,0,
  6.     "\033PpS(E)P[384,240]\033\\\033PrSM0\033\\\033[20;1H",
  7.     "\033PrSM2\033\\\033PpS(E)\033\\",
  8.     "\033PrSM2\033\\\033PpS(E)\033\\",
  9.     "\033PpS(E)\033\\",
  10.     gigiturt,gigifrom,gigito,gtcheck,nullfn,nullfn,nullfn,
  11.     gpenc,nullfn,gstate};
  12.  
  13. char *gigipens[] = {"W(R)","W(E)","W(C)"};
  14.  
  15. gtcheck() {
  16.     if (textmode) {
  17.         printf("Not in text mode!\n");
  18.         errhand();
  19.     }
  20. }
  21.  
  22. gmovepos(x,y)
  23. int x,y;
  24. {
  25.     char s[5];
  26.  
  27.     x += 384;
  28.     y = 240 - y;
  29.     printf("P[%d,%d]",x,y);
  30. }
  31.  
  32. gplotpos(x,y)
  33. int x,y;
  34. {
  35.     char s[5];
  36.  
  37.     x += 384;
  38.     y = 240 - y;
  39.     printf("V[%d,%d]",x,y);
  40. }
  41.  
  42. gigifrom(oldx,oldy)
  43. double oldx,oldy;
  44. {
  45.     printf("\033Pp");
  46.     gmovepos((int)oldx,(int)oldy);
  47. }
  48.  
  49. gigito(newx,newy)
  50. double newx,newy;
  51. {
  52.     printf(gigipens[penerase]);
  53.     gplotpos((int)newx,(int)newy);
  54.     printf("\033\\");
  55. }
  56.  
  57. gigiturt()
  58. {
  59.     double newx,newy,angle;
  60.  
  61.     printf("\033PpW(C)");
  62.     angle = (mydpy->turth-90.0)*3.141592654/180.0;
  63.     newx = mydpy->turtx + 15.0*sin(angle);
  64.     newy = mydpy->turty + 15.0*cos(angle);
  65.     gmovepos((int)newx,(int)(yscrunch*newy));
  66.     angle = mydpy->turth*3.141592654/180.0;
  67.     newx = mydpy->turtx + 15.0*sin(angle);
  68.     newy = mydpy->turty + 15.0*cos(angle);
  69.     gplotpos((int)newx,(int)(yscrunch*newy));
  70.     angle = (mydpy->turth+90.0)*3.141592654/180.0;
  71.     newx = mydpy->turtx + 15.0*sin(angle);
  72.     newy = mydpy->turty + 15.0*cos(angle);
  73.     gplotpos((int)newx,(int)(yscrunch*newy));
  74.     angle = (mydpy->turth-90.0)*3.141592654/180.0;
  75.     newx = mydpy->turtx + 15.0*sin(angle);
  76.     newy = mydpy->turty + 15.0*cos(angle);
  77.     gplotpos((int)newx,(int)(yscrunch*newy));
  78.     printf(gigipens[penerase]);
  79.     printf("\033\\");
  80. }
  81.  
  82. gpenc(ipen)
  83. register int ipen;
  84. {
  85.     if ((ipen<0) || (ipen>7)) {
  86.         puts("Bad pen color, must be 0 to 7.");
  87.         errhand();
  88.     }
  89.     printf("\033PpW(I%d)\033\\",ipen);
  90. }
  91.  
  92. gstate(which) {
  93.     switch (which) {
  94.         case 't':
  95.             printf("\033PrSM2\033\\\033PpS(E)\033\\");
  96.             break;
  97.         case 's':
  98.         case 'f':
  99.             printf("\033PrSM0\033\\\033PpS(E)\033\\");
  100.             if (textmode && shown) gigiturt();
  101.             break;
  102.         case '*':
  103.             printf("\033[K");
  104.     }
  105. }
  106.  
  107.