home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_USER / 1990 / USERJL90.MSA / LISTINGS.ARC / GEM.C < prev    next >
C/C++ Source or Header  |  1990-05-16  |  2KB  |  45 lines

  1. /* Using the VDI: Program I */
  2. /*      By R.A.Waddilove    */
  3. /*      Digital Wizdom C    */
  4.  
  5. /* short is a 16-bit integer and is    */
  6. /* equivalent to most C compilers' int */
  7.  
  8. short   control[12],            /* These arrays are used by  */
  9.         intin[128],             /* GEM and you don't need to */
  10.         ptsin[128],             /* worry about them. Define  */
  11.         intout[128],            /* them, then forget them.   */
  12.         ptsout[128];
  13.  
  14. short   handle,                 /* virtual workstation handle */
  15.         app_id;                 /* application's id number */
  16.  
  17. short   work_in[12],        /* hold various parameters which set the */
  18.         work_out[57];       /* line type, fill pattern, text style etc. */
  19.  
  20. main()
  21. {
  22.     short i;                    /* loop counter, nothing important */
  23.     app_id = appl_init();       /* initialise GEM AES arrays, return id */
  24.     for ( i=0; i<10; ++i )      /* set line type, text style, fill style */
  25.         work_in[i] = 1;         /* text style and other parameters */
  26.     work_in[10] = 0;            /* raster coordinates ie. pixels */
  27.     v_opnvwk(work_in, &handle, work_out);   /* open virtual workstation */
  28.  
  29.     v_clrwk(handle);            /* clear the screen */
  30.     v_gtext(handle, 16, 16,"This is a test...");    /* print some text */
  31.     v_gtext(handle, 16, 32,"Click the mouse button..."); /* more text */
  32.     wait();                     /* wait for mouse click */
  33.  
  34.     v_clsvwk(handle);           /* close virtual workstation */
  35.     appl_exit();                /* tell GEM we've finished */
  36. }
  37.  
  38. wait()
  39. {
  40.     short x, y, button;
  41.     do {
  42.         vq_mouse(handle, &button, &x, &y);  /* get mouse x,y,button state */
  43.     } while ( button==0 );      /* wait until a button is pressed */
  44. }
  45.