home *** CD-ROM | disk | FTP | other *** search
/ Graphics 16,000 / graphics-16000.iso / sgi / editors / kali.lha / kali / irisio.c < prev    next >
C/C++ Source or Header  |  1992-09-14  |  2KB  |  113 lines

  1. /*                        */
  2. /***** irisio.c - Nina Amenta, Aug. 1989 ****/
  3. /*                        */
  4. #include <stdio.h>
  5. #include <ctype.h>
  6. #include <gl.h>
  7. #include <device.h>
  8. #include "symmetry.h"
  9.  
  10.  
  11. DrawDot(p)
  12. POINT *p;
  13. {
  14.     pnt2(p->x,p->y);
  15. }
  16.  
  17. void PickLine(l)
  18. LINE *l;
  19. {
  20.     popname();
  21.     popname();
  22.     pushname(l->id);      /* change TOS to new line number */
  23.     pushname(l->obj_pos);
  24.     move2(l->m[SX],l->m[SY]);
  25.     draw2(l->m[EX],l->m[EY]);
  26. }
  27.  
  28. void DrawLine(l)
  29. LINE *l;
  30. {
  31.     move2(l->m[SX],l->m[SY]);
  32.     draw2(l->m[EX],l->m[EY]);
  33. }
  34.  
  35. Flush()
  36. {
  37. }
  38.  
  39. LogTranslation(i)
  40. int i;
  41. {
  42.   short s;
  43.     s = i;
  44.     popname();          /* the last line is  the top of the stack */
  45.     popname();
  46.     loadname(s);        /* change to new translation */
  47.     pushname(-1);       /* placeholder for first line */
  48.     pushname(-1);
  49. }
  50.  
  51. TranslateCoordinates(x,y,z)
  52. float x,y,z;
  53. {
  54.     pushmatrix();
  55.     translate(x,y,z);
  56. }
  57.  
  58. TranslateBack()
  59. {
  60.     popmatrix();
  61. }
  62.  
  63. char *KeyboardIO(numchars,x,y,str,scale)
  64. int numchars;
  65. float x,y;
  66. char *str;
  67. float scale;
  68. {
  69.     static char buffer[21];
  70.     char* ptr;
  71.     short newchar;
  72.     EVENT ev;
  73.  
  74.     singlebuffer();
  75.     gconfig();
  76.     if (numchars>20) numchars=20;
  77.     color(GREEN);
  78.     rectf(scale*(x-3.0),scale*(y-3.0),scale*(x+228.0),scale*(y+12.0));
  79.     color(BLACK);
  80.     cmov2(scale*x,scale*y);
  81.     charstr(str);
  82.     ptr = buffer;
  83.     if (numchars>0)
  84.     {
  85.     qreset();
  86.         qdevice(KEYBD);
  87.     while ((ev = qread(&newchar)) == KEYBD)
  88.     {
  89.        if (ptr+1>=buffer+numchars) break;
  90.        if (!(isalnum(newchar) || (newchar == '.') || (newchar == '/'))) 
  91.            break;
  92.        *ptr++ = newchar;
  93.        *ptr = 0;
  94.        charstr(ptr-1);
  95.     }
  96.         unqdevice(KEYBD);
  97.     }
  98.    *ptr = 0;
  99.     doublebuffer();
  100.     gconfig();
  101.     return(buffer);
  102. }
  103.  
  104. DrawObject(obj,drawing_routine)
  105. LINE *obj;
  106. void (*drawing_routine) ();
  107. {
  108. LINE *l;
  109.     for(l=obj; l!=NULL; l=l->next)
  110.     drawing_routine(l);
  111. }
  112.  
  113.