home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / dev / amiga_e-2.1b.lha / Amiga_E-2.1b / Sources / Projects / YaxSrc / ypaint.yax < prev   
Encoding:
Text File  |  1993-10-05  |  4.5 KB  |  150 lines

  1. /*  Note: Number colors currently at 4
  2. Ypaint freeware @1993 Ben Schaeffer 
  3.  a  b  x   y
  4. 20 20 400 180 small, but which makes for unsafe BLITS
  5.  0  0 640 200 NTSC HIRES
  6.  0  0 640 256 PAL  HIRES
  7.  0  0 640 400 NTSC HIRES LACE
  8.  0  0 640 512 PAL  HIRES LACE 
  9. */
  10.  
  11. (set a 0)(set b 0)(set x 640)(set y 200)
  12. (window  a b x y 'Ypaint   Act   Cls   Bru   BoxLine')
  13.  
  14. (set c 1) /* color */
  15. (set a 4) /* x brush size */
  16. (set b 2) /* y brush size */
  17. (set o -1) /* now set for box mode, i.e. Not line mode */
  18. (set u -1) /* brush mode active */
  19. (set t -1) /* Ypaint active */
  20.  
  21. (write 'Welcome to Ypaint 1.3, by Ben Schaeffer.')
  22. (write 'Use at your own risk!')
  23. (write 'Warning: resizing and drawing outside this window may give unwanted results')
  24. (write 'If you want a smaller window, just make it SLEEP when you stop drawing')
  25. (write 'If you do not make Ypaint SLEEP it will continue to work, even if you are')
  26. (write 'viewing another screen.')
  27. (write)
  28. (write 'Click on Ypaint or anywhere else to move window.')
  29. (write 'Click on Act to toggle between active and sleep.')/*write as such*/
  30. (write 'Click on Cls to clear screen.')
  31. (write 'Click on Bru to enter freehand mode.')
  32. (write 'Click on Bru again to change brush size.')/*dot, small, medium, large, huge*/
  33. (write 'Click on BoxLine to enter box and line mode.')
  34. (write 'Click on BoxLine to go between box and line mode.')
  35. (write 'Press RMB to change color.')
  36. (write)
  37. (write 'Hold LMB and RMB to quit.')
  38. (write)
  39. (write '...click RMB mouse to paint...') 
  40. (while (eq (mouse) 0 ) )               
  41. (cls)
  42. (locate 1 1)
  43. (write 'color ' c)
  44.  
  45. /* Main drawing loop */ 
  46. (while (uneq (mouse) 3)
  47.   (while (eq (mouse) 1)
  48.     (set x (mousex))
  49.     (set y (mousey))
  50.     (if (greater (mousey) 10)
  51.       /* then draw */
  52.       (if u /* brush */
  53.         (box x y (add x a) (add y b) c)
  54.         (do      
  55.           (if o /* else box */
  56.             (do
  57.               (while (mouse))
  58.               (set e (mousex))
  59.               (set f (mousey))
  60.               (if (greater x e) 
  61.                 (do 
  62.                   (set t x)
  63.                   (set x e)
  64.                   (set e t) 
  65.                 )
  66.               )
  67.               (if (greater y f)
  68.                 (do 
  69.                   (set t y)
  70.                   (set y f)
  71.                   (set f t) 
  72.                 )
  73.               )
  74.               (if (greater (or x y e f) 16000)
  75.                 (do
  76.                   (locate 1 1)
  77.                   (write 'BlitBAD 'x' 'y' 'e' 'f)
  78.                 )
  79.                   (box x y e f c)
  80.               )
  81.             )
  82.           )
  83.           (do /* else line */
  84.             (while (mouse))
  85.             (set e (mousex))
  86.             (set f (mousey))
  87.             (if (greater (or x y e f) 16000)
  88.               (do
  89.                 (locate 1 1)
  90.                 (write 'BlitBAD')
  91.               )
  92.               (line x y e f c)
  93.             )
  94.           )
  95.         )
  96.       )
  97.       /* else title bar routines */
  98.       (do      
  99.         (set x (mousex))
  100.         (if (and (smaller x 275) (greater (mousex) 77)) /* Act to BoxLine */
  101.           (do
  102.             (if (and (smaller x 198) (greater x 171) )  /* if Bru */
  103.               (do
  104.                 (set u -1)
  105.                 (set a (+ a 2)) /* change 2 or 1 skinny or wide boxes */                
  106.                 (set b (+ b 1)) 
  107.                 (if (eq b 5) /* increase 6 for bigger brush */
  108.                   (do
  109.                     (set a 0)
  110.                     (set b 0)
  111.                   )
  112.                 )
  113.                 (locate 1 1)
  114.                 (write 'x=' a ' y=' b)
  115.               )
  116.               (if (greater x 219) /* else if BoxLine */
  117.                 (do
  118.                   (set u 0)
  119.                   (set o (not o))
  120.                   (locate 1 1)
  121.                   (if o (write 'box    ') (write 'line   '))
  122.                 )
  123.                 (if (smaller x 101) /* else if Act */
  124.                   (do
  125.                     (locate 1 1)
  126.                     (write 'SLEEP  ')
  127.                     (while (not (and (eq 1 (mouse)) (and (greater (mousex) 77) (smaller (mousex) 101) (smaller (mousey) 10)))))
  128.                     (locate 1 1)
  129.                     (write 'active ')
  130.                   )
  131.                   (if (and (greater x 124) (smaller x 150)) /* else Cls check */
  132.                     (cls)
  133.                   )
  134.                 )
  135.               )
  136.             )
  137.           )
  138.           (while (mouse)) /* else wait for window move to end */
  139.         )
  140.       )
  141.     )
  142.   )
  143.   (while (eq (mouse) 2 ) 
  144.     (set c (+ c 1) )
  145.     (if (eq c 4) (set c 0))
  146.     (locate 1 1)
  147.     (write 'color ' c)      
  148.   )
  149. )
  150.