;; draw-microwave consumes a posn, a number and 3 colors (symbols)
;;
;; (draw-microwave position width col1 col2 col3)
;; will draw a square microwave starting at the posn specified,
;; with a width specified by the parameter supplied
;; by the user note:: Width must be greater than or equal to 20
;; the first color is the base color, the second is the color of the round buttons and display
;; the third color alternates with the second for the grid of buttons
;;
;; note that the position is used as the top left corner of the microwave
;;
;; draw-microwave calls functions draw-square, draw-2squares, and draw-2x2 to create the grid of buttons
;; sample usage:
;; (draw-microwave (make-posn 100 200) 50 'red 'white 'blue)
;; (draw-microwave (make-posn 150 15) 50 'blue 'white 'green)
;;
;;
;; note that this requires the teachpack draw.ss and requires that the
;; start function has already been called to create a window.
(define (draw-microwave posn width col1 col2 col3)
(and
(draw-solid-rect posn width width col1)
(draw-solid-disk (make-posn (+ (posn-x posn) (* .17 width)) (+ (posn-y posn) (* .17 width))) (floor (* width .12)) col2)
(draw-solid-disk (make-posn (+ (posn-x posn) (* .36 width)) (+ (posn-y posn) (* .10 width))) (floor (* width .05)) col2)
(draw-solid-disk (make-posn (+ (posn-x posn) (floor(* .37 width))) (+ (posn-y posn) (floor(* .24 width)))) (floor (floor(* width .05))) col2)
(draw-2x2 (make-posn (+ (posn-x posn) (floor(* .5 width))) (+ (posn-y posn) (floor(* .05 width)))) (floor (* width .08)) col3 col2)
(draw-2x2 (make-posn (+ (posn-x posn) (floor(* .5 width)) (* 2 (floor(* .08 width)))) (+ (posn-y posn) (floor(* .05 width)))) (floor (* width .08)) col3 col2)
(draw-2squares (make-posn (+ (posn-x posn) (floor(* .5 width))) (+ (posn-y posn) (floor(* .05 width)) (* 2 (floor(* .08 width))))) (floor (* width .08)) col3 col2)
(draw-2squares (make-posn (+ (posn-x posn) (floor(* .5 width)) (* 2 (floor(* .08 width)))) (+ (posn-y posn) (floor(* .05 width)) (* 2 (floor(* .08 width))))) (floor (* width .08)) col3 col2)
(draw-circle (make-posn (+ (posn-x posn) (floor(* .5 width))) (+ (posn-y posn) (floor(* .65 width)))) (floor (* width .3)) 'black)
))
(define (draw-2x2 posn width col1 col2)
(and(draw-2squares posn width col1 col2)
(draw-2squares (make-posn (posn-x posn) (+ (posn-y posn) width)) width col2 col1)))
(define (draw-2squares posn width col1 col2)
(and(draw-square posn width col1)
(draw-square (make-posn(+ (posn-x posn) width) (posn-y posn)) width col2)))
(define (draw-square posn width color)
(draw-solid-rect posn width width color))
;(start 600 600)
;(draw-microwave (make-posn 25 25) 210 'blue 'white 'green)