home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1999 April
/
VPR9904A.BIN
/
Vpr_data
/
Special
/
Yoolw101
/
Yoolw101.lzh
/
draw.yo
< prev
next >
Wrap
Lisp/Scheme
|
1998-03-21
|
4KB
|
156 lines
(de 'cls '(lambda(no x y)(gr_boxf no 0 0 x y (rgb 255 255 255))))
(de 'color '(lambda(x)(switch x
(0 (rgb 0 0 0))
(1 (rgb 0 0 255))
(2 (rgb 255 0 0))
(3 (rgb 255 0 255))
(4 (rgb 0 255 0))
(5 (rgb 0 255 255))
(6 (rgb 255 255 0))
(7 (rgb 255 255 255))
(t (rgb 0 0 0))
)))
(de 'menu '(lambda(no mode col)(prog(c)
(gr_box no 0 0 16 16 0)
(gr_box no 0 16 16 32 0)
(gr_box no 0 32 16 48 0)
(gr_box no 0 48 16 64 0)
(switch mode
(1 (prog()
(gr_boxf no 1 1 15 15 (rgb 255 0 0))
(gr_boxf no 1 17 15 31 (rgb 255 255 255))
(gr_boxf no 1 33 15 47 (rgb 255 255 255))
(gr_boxf no 1 49 15 63 (rgb 255 255 255))
))
(2 (prog()
(gr_boxf no 1 1 15 15 (rgb 255 255 255))
(gr_boxf no 1 17 15 31 (rgb 255 0 0))
(gr_boxf no 1 33 15 47 (rgb 255 255 255))
(gr_boxf no 1 49 15 63 (rgb 255 255 255))
))
(3 (prog()
(gr_boxf no 1 1 15 15 (rgb 255 255 255))
(gr_boxf no 1 17 15 31 (rgb 255 255 255))
(gr_boxf no 1 33 15 47 (rgb 255 0 0))
(gr_boxf no 1 49 15 63 (rgb 255 255 255))
))
(t (prog()
(gr_boxf no 1 1 15 15 (rgb 255 255 255))
(gr_boxf no 1 17 15 31 (rgb 255 255 255))
(gr_boxf no 1 33 15 47 (rgb 255 255 255))
(gr_boxf no 1 49 15 63 (rgb 255 255 255))
))
)
(gr_line no 4 4 12 12 0)
(gr_circle no 4 20 12 28 0)
(gr_box no 4 38 12 42 0)
(gr_symbol no 2 52 "End" 0 8 0)
color_box
(setq c 0)
label0
(gr_boxf no 16 (* c 16) 32 (+ (* c 16) 16) (color c))
(cond ((eq col c)(gr_box no 16 (* c 16) 32 (+ (* c 16) 16) (rgb 255 0 0))))
(setq c (++ c))
(cond ((< c 7)(go label0)))
)))
(de 'draw '(lambda(x y)(prog(vx vy mode col btn_count mainw menuw)
(setq mainw (gr_open x y))
(setq menuw (gr_open 34 132 0))
(setq vx x)
(setq vy y)
(gr_vsize mainw x y)
(cls mainw vx vy)
(gr_box mainw 0 0 (- vx 1) (- vy 1) 0)
(setq mode 0)
(setq col 0)
(menu menuw mode col)
(setq btn_count 0)
(loop(mx my mx0 my0 mxy gxy menux menuy)
(cond ((eq mode -1)(return t)))
(setq mxy (ms_left))
(setq gxy (gr_xy mainw))
(setq mx (+ (caadr mxy) (car gxy)))
(setq my (+ (cdadr mxy) (cdr gxy)))
;(print (cons mx my))
(setq menux (truncate(/ (caadr mxy) 16)))
(setq menuy (truncate(/ (cdadr mxy) 16)))
;(print (cons menux menuy))
(cond
((eq (car mxy) menuw)(prog()
(if (and (eq menux 0) (< menuy 4))
(switch menuy
(0 (prog()
(setq mode 1)
(setq btn_count 0)
(menu menuw mode col)
))
(1 (prog()
(setq mode 2)
(setq btn_count 0)
(menu menuw mode col)
))
(2 (prog()
(setq mode 3)
(setq btn_count 0)
(menu menuw mode col)
))
(3 (return (setq mode -1)))
)
)
(if (and (eq menux 1) (< menuy 7))(prog()
(setq col menuy)
(menu menuw mode col)
))
))
(t (switch mode
(1 (prog()
(cond
((eq btn_count 0)(prog()
(setq mx0 mx)
(setq my0 my)
(setq btn_count 1)
))
(t (prog()
(gr_line mainw mx0 my0 mx my (color col))
(setq btn_count 0)
))
)
))
(2 (prog()
(cond
((eq btn_count 0)(prog()
(setq mx0 mx)
(setq my0 my)
(setq btn_count 1)
))
(t (prog()
(gr_circle mainw mx0 my0 mx my (color col))
(setq btn_count 0)
))
)
))
(3 (prog()
(cond
((eq btn_count 0)(prog()
(setq mx0 mx)
(setq my0 my)
(setq btn_count 1)
))
(t (prog()
(gr_box mainw mx0 my0 mx my (color col))
(setq btn_count 0)
))
)
))
))
)
)
(gr_close mainw)
(gr_close menuw)
)))
" Windowsアプリケーション例"
"(draw ウインドの横幅 ウインドの縦の長さ):オペレーションウインドと"
" メインウインドの2つのウインドを開き、オペレーションウイン"
" ドで図形と色を選択し、メインウインドに図形を描く。"