home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / jËzyki_programowania / logo / powerlogo / examples / mouse-paint < prev    next >
Text File  |  1992-11-10  |  1KB  |  33 lines

  1.  
  2. ;     This example is a simple paint program. The first instruction opens a
  3. ;  window, the second programs the mouse button demon to draw lines
  4. ;  whenever the mouse button is pressed in this window.
  5. ;     This runs entirely in the background, another program may be running
  6. ;  at the same time 
  7.  
  8. make "m-window openwindow [ @0 131 [ Mouse Paint ] 320 ]
  9. whenmouse [
  10.    while [ mousep ] [ make "m-d getmouse ]      ;  Remove mouse event.
  11.    if = :m-window first :m-d [                  ;  Correct window?
  12.       move :m-window item 2 :m-d item 3 :m-d    ;  Move cursor.
  13.       make "m-d mouse :m-window                 ;  Check mouse.
  14.       while [ = 1 item 3 :m-d ] [               ;  While button is down
  15.          draw :m-window first :m-d item 2 :m-d  ;  Draw to pointer.
  16.          make "m-d mouse :m-window              ;  Check mouse.
  17.       ]
  18.    ] [ ]
  19. ]
  20.  
  21. pr [ ]
  22. pr [ Click and draw with the mouse ]
  23. pr [ in the Mouse Paint window. ]
  24. pr [ ]
  25. pr [ This is a crude but very simple ]
  26. pr [ example of a demon in action. ]
  27. pr [ Notice that this runs entirely ]
  28. pr [ in the background, LOGO could ]
  29. pr [ be running another program at ]
  30. pr [ the same time. ]
  31. pr [ ]
  32.  
  33.