[ Previous | Next | Contents | Glossary | Home | Search ]
GL3.2 for AIX: Graphics Library (GL) Technical Reference

text.c Example C Language Program

/*
text.c:
A text drawing sample program using the charstr() subro utine.
*/
#include <gl/gl.h>
#include <gl/device.h>
main()
{
   Device dev;
   short val;    
   initialize();    
   while (TRUE) {
      if (qtest()) {
         dev = qread(&val);            
         if (dev == ESCKEY) {
            gexit();
            exit();
         }
         else if (dev == REDRAW) {
            reshapeviewport();
            drawtext();
         }
      }
   }
}
initialize()
{
   int gid;    
   prefposition(XMAXSCREEN/4, XMAXSCREEN*3/4, YMAXSCREEN/4, 
       YMAXSCREEN*3/4);
   gid = winopen("text");
   winconstraints();    
   qdevice(ESCKEY);
   qdevice(REDRAW);
   qenter(REDRAW,gid);
}
drawtext()
{
   color(BLACK);
   clear();
   color(RED);
   cmov2i(300,380);
   charstr("The first line is drawn ");
   charstr("in two parts. ");
   cmov2i(300, 368);
   charstr("This line is 12 pixels lower. ");
}

Related Information

The curson or cursoff subroutine.


[ Previous | Next | Contents | Glossary | Home | Search ]