home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / agl103p.lha / src / agl / text.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-09  |  4.0 KB  |  171 lines

  1. /******************************************************************************
  2.  
  3. Copyright © 1994 Jason Weber
  4. All Rights Reserved
  5.  
  6. $Id: text.c,v 1.2.1.4 1994/12/09 05:29:56 jason Exp $
  7.  
  8. $Log: text.c,v $
  9.  * Revision 1.2.1.4  1994/12/09  05:29:56  jason
  10.  * added copyright
  11.  *
  12.  * Revision 1.2.1.3  1994/11/16  06:30:09  jason
  13.  * adjust for borders
  14.  *
  15.  * Revision 1.2.1.2  1994/09/13  03:53:06  jason
  16.  * fixed alignment of text
  17.  *
  18.  * Revision 1.2.1.1  1994/03/29  05:41:32  jason
  19.  * Added RCS Header
  20.  *
  21.  * Revision 1.2.1.1  2002/03/26  22:04:24  jason
  22.  * Added RCS Header
  23.  *
  24.  * Revision 1.2.1.1  2002/03/26  22:00:51  jason
  25.  * RCS/agl.h,v
  26.  *
  27.  
  28. ******************************************************************************/
  29.  
  30.  
  31. #ifndef NOT_EXTERN
  32. #include"agl.h"
  33. #endif
  34.  
  35. long TextX[MAX_WINDOWS],TextY[MAX_WINDOWS];
  36.  
  37.  
  38. /******************************************************************************
  39. void    cmov2s(long sx,long sy)
  40.  
  41. ******************************************************************************/
  42. /*PROTOTYPE*/
  43. void cmov2i(long sx,long sy)
  44.     {
  45.     if(OneToOne[CurrentWid])    /* bypass transforms if no effect */
  46.         {
  47.         TextX[CurrentWid]=sx;
  48.         TextY[CurrentWid]=sy;
  49.         }
  50.     else
  51.         cmov((float)sx,(float)sy,(float)0.0);
  52.     }
  53.  
  54.  
  55. /******************************************************************************
  56. void    cmovs(long sx,long sy,long sz)
  57.  
  58. ******************************************************************************/
  59. /*PROTOTYPE*/
  60. void cmovi(long sx,long sy,long sz)
  61.     {
  62.     cmov((float)sx,(float)sy,(float)sz);
  63.     }
  64.  
  65.  
  66. /******************************************************************************
  67. void    cmov2s(short sx,short sy)
  68.  
  69. ******************************************************************************/
  70. /*PROTOTYPE*/
  71. void cmov2s(short sx,short sy)
  72.     {
  73.     if(OneToOne[CurrentWid])    /* bypass transforms if no effect */
  74.         {
  75.         TextX[CurrentWid]=sx;
  76.         TextY[CurrentWid]=sy;
  77.         }
  78.     else
  79.         cmov((float)sx,(float)sy,(float)0.0);
  80.     }
  81.  
  82.  
  83. /******************************************************************************
  84. void    cmovs(short sx,short sy,short sz)
  85.  
  86. ******************************************************************************/
  87. /*PROTOTYPE*/
  88. void cmovs(short sx,short sy,short sz)
  89.     {
  90.     cmov((float)sx,(float)sy,(float)sz);
  91.     }
  92.  
  93.  
  94. /******************************************************************************
  95. void    cmov2(float fx,float fy)
  96.  
  97. ******************************************************************************/
  98. /*PROTOTYPE*/
  99. void cmov2(float fx,float fy)
  100.     {
  101.     if(OneToOne[CurrentWid])    /* bypass transforms if no effect */
  102.         {
  103.         TextX[CurrentWid]=fx;
  104.         TextY[CurrentWid]=fy;
  105.         }
  106.     else
  107.         cmov(fx,fy,(float)0.0);
  108.     }
  109.  
  110.  
  111. /******************************************************************************
  112. void    cmov(float fx,float fy,float fz)
  113.  
  114. ******************************************************************************/
  115. /*PROTOTYPE*/
  116. void cmov(float fx,float fy,float fz)
  117.     {
  118.     float vert[3],rvert[3],pvert[3];
  119.  
  120.     vert[0]=fx;
  121.     vert[1]=fy;
  122.     vert[2]=fz;
  123.  
  124.     rotate_translate_position(vert,rvert);
  125.     project_vertex(rvert,pvert);
  126.  
  127. /*
  128.     TextX[CurrentWid]=CurrentWidth* (pvert[0]+1.0)/2.0+0.5;
  129.     TextY[CurrentWid]=CurrentHeight*(pvert[1]+1.0)/2.0+0.5;
  130. */
  131.  
  132.     TextX[CurrentWid]=ViewPort[CurrentWid][0] + ViewPort[CurrentWid][1] * (pvert[0]+1.0)/2.0;
  133.     TextY[CurrentWid]=ViewPort[CurrentWid][2] + ViewPort[CurrentWid][3] * (pvert[1]+1.0)/2.0;
  134.     }
  135.  
  136.  
  137. /******************************************************************************
  138. void    charstr(char *string)
  139.  
  140. ******************************************************************************/
  141. /*PROTOTYPE*/
  142. void charstr(char *string)
  143.     {
  144.     short cx,cy;
  145.  
  146.     getcpos(&cx,&cy);
  147.  
  148.     cy=CurrentHeight-1-cy;
  149.  
  150.     if(Bordered[CurrentWid])
  151.         {
  152.         cx+=BorderWidth;
  153.         cy+=BorderWidth+BorderHeight;
  154.         }
  155.  
  156.     Move(DrawRPort,cx,cy);
  157.     Text(DrawRPort,string,(ULONG)strlen(string));
  158.     }
  159.  
  160.  
  161. /******************************************************************************
  162. void    getcpos(short *cx,short *cy)
  163.  
  164. ******************************************************************************/
  165. /*PROTOTYPE*/
  166. void getcpos(short *cx,short *cy)
  167.     {
  168.     *cx=TextX[CurrentWid];
  169.     *cy=TextY[CurrentWid];
  170.     }
  171.