home *** CD-ROM | disk | FTP | other *** search
- /* Note: Number colors currently at 4
- Ypaint freeware @1993 Ben Schaeffer
- a b x y
- 20 20 400 180 small, but which makes for unsafe BLITS
- 0 0 640 200 NTSC HIRES
- 0 0 640 256 PAL HIRES
- 0 0 640 400 NTSC HIRES LACE
- 0 0 640 512 PAL HIRES LACE
- */
-
- (set a 0)(set b 0)(set x 640)(set y 200)
- (window a b x y 'Ypaint Act Cls Bru BoxLine')
-
- (set c 1) /* color */
- (set a 4) /* x brush size */
- (set b 2) /* y brush size */
- (set o -1) /* now set for box mode, i.e. Not line mode */
- (set u -1) /* brush mode active */
- (set t -1) /* Ypaint active */
-
- (write 'Welcome to Ypaint 1.3, by Ben Schaeffer.')
- (write 'Use at your own risk!')
- (write 'Warning: resizing and drawing outside this window may give unwanted results')
- (write 'If you want a smaller window, just make it SLEEP when you stop drawing')
- (write 'If you do not make Ypaint SLEEP it will continue to work, even if you are')
- (write 'viewing another screen.')
- (write)
- (write 'Click on Ypaint or anywhere else to move window.')
- (write 'Click on Act to toggle between active and sleep.')/*write as such*/
- (write 'Click on Cls to clear screen.')
- (write 'Click on Bru to enter freehand mode.')
- (write 'Click on Bru again to change brush size.')/*dot, small, medium, large, huge*/
- (write 'Click on BoxLine to enter box and line mode.')
- (write 'Click on BoxLine to go between box and line mode.')
- (write 'Press RMB to change color.')
- (write)
- (write 'Hold LMB and RMB to quit.')
- (write)
- (write '...click RMB mouse to paint...')
- (while (eq (mouse) 0 ) )
- (cls)
- (locate 1 1)
- (write 'color ' c)
-
- /* Main drawing loop */
- (while (uneq (mouse) 3)
- (while (eq (mouse) 1)
- (set x (mousex))
- (set y (mousey))
- (if (greater (mousey) 10)
- /* then draw */
- (if u /* brush */
- (box x y (add x a) (add y b) c)
- (do
- (if o /* else box */
- (do
- (while (mouse))
- (set e (mousex))
- (set f (mousey))
- (if (greater x e)
- (do
- (set t x)
- (set x e)
- (set e t)
- )
- )
- (if (greater y f)
- (do
- (set t y)
- (set y f)
- (set f t)
- )
- )
- (if (greater (or x y e f) 16000)
- (do
- (locate 1 1)
- (write 'BlitBAD 'x' 'y' 'e' 'f)
- )
- (box x y e f c)
- )
- )
- )
- (do /* else line */
- (while (mouse))
- (set e (mousex))
- (set f (mousey))
- (if (greater (or x y e f) 16000)
- (do
- (locate 1 1)
- (write 'BlitBAD')
- )
- (line x y e f c)
- )
- )
- )
- )
- /* else title bar routines */
- (do
- (set x (mousex))
- (if (and (smaller x 275) (greater (mousex) 77)) /* Act to BoxLine */
- (do
- (if (and (smaller x 198) (greater x 171) ) /* if Bru */
- (do
- (set u -1)
- (set a (+ a 2)) /* change 2 or 1 skinny or wide boxes */
- (set b (+ b 1))
- (if (eq b 5) /* increase 6 for bigger brush */
- (do
- (set a 0)
- (set b 0)
- )
- )
- (locate 1 1)
- (write 'x=' a ' y=' b)
- )
- (if (greater x 219) /* else if BoxLine */
- (do
- (set u 0)
- (set o (not o))
- (locate 1 1)
- (if o (write 'box ') (write 'line '))
- )
- (if (smaller x 101) /* else if Act */
- (do
- (locate 1 1)
- (write 'SLEEP ')
- (while (not (and (eq 1 (mouse)) (and (greater (mousex) 77) (smaller (mousex) 101) (smaller (mousey) 10)))))
- (locate 1 1)
- (write 'active ')
- )
- (if (and (greater x 124) (smaller x 150)) /* else Cls check */
- (cls)
- )
- )
- )
- )
- )
- (while (mouse)) /* else wait for window move to end */
- )
- )
- )
- )
- (while (eq (mouse) 2 )
- (set c (+ c 1) )
- (if (eq c 4) (set c 0))
- (locate 1 1)
- (write 'color ' c)
- )
- )
-