home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / prog / graphics / move.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  569 b   |  44 lines

  1. #include <LEDA/window.h>
  2.  
  3. window W;
  4.  
  5. double w,h;
  6.  
  7. void draw_rect(double x, double y)
  8. { W.set_mode(xor_mode);
  9.   W.draw_rectangle(x,y,x+w,y+h);
  10.   W.set_mode(src_mode);
  11. }
  12.  
  13. main()
  14. {
  15.  
  16.    real x,y,x0,y0,x1,y1;
  17.    int k=0;
  18.  
  19.    segment s;
  20.    circle c;
  21.  
  22.    while (W >> s) W << s;
  23.  
  24.    while (W >> c) W << c;
  25.  
  26.    while (k!=3)
  27.    {
  28.      W.read_mouse(x0,y0);
  29.  
  30.      W.read_mouse_rect(x0,y0,x1,y1);
  31.  
  32.      w = x1-x0;
  33.      h = y1-y0;
  34.  
  35.      k = W.read_mouse_action(draw_rect,x,y);
  36.  
  37.      if (k==1) W.copy_rect(x0,y0,x1,y1,x,y);
  38.      if (k==2) W.move_rect(x0,y0,x1,y1,x,y);
  39.      
  40.    }
  41.  
  42. }
  43.  
  44.