home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d571 / gwin.lha / Gwin / Examples / rubberbandbox.c < prev    next >
C/C++ Source or Header  |  1991-12-22  |  719b  |  35 lines

  1. #include "gwin.user.h"
  2. main()
  3. {
  4. float x,y,xold,yold,xanchor,yanchor;
  5.  
  6.    USTART("high2",0.,640.,0.,400.);
  7.  
  8.    upset(G,"colo",1.0);
  9.    uprint(G,10.,90.,"Press left mouse button, hold, drag, release...");
  10.  
  11.    uset(G,"comp");
  12.    upset(G,"colo",1.0);
  13.    uset(G,"ncli");
  14.    uuev.key = '\0';
  15.  
  16.    while (1==1){
  17.       while(uuev.key != 'a'){
  18.          if(ugrinc(G,&x,&y,&uuev)){UEND();exit(0);};
  19.       }
  20.       xanchor = x;   /* anchor point */
  21.       yanchor = y;
  22.       xold = x;
  23.       yold = y;
  24.  
  25.       while (uuev.key != 'A'){
  26.          if(ugrinl(G,&x,&y,&uuev)){UEND();exit(0);};
  27.          urect(G,xanchor,yanchor,xold,yold);
  28.          urect(G,xanchor,yanchor,x,y);
  29.          xold = x;
  30.          yold = y;
  31.       }
  32.    }
  33.    UEND();
  34. }
  35.