diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-07 12:11:59 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-07 12:11:59 -0700 |
commit | dd192dd52c755f40e09d7d60a95fbf57faa9b669 (patch) | |
tree | 8236083f8bcb500df4c067db6589d6d43a97a30b /shell | |
parent | e42ae8219eae6a48b7fc7746a9883c1e46d0be65 (diff) | |
download | mu-dd192dd52c755f40e09d7d60a95fbf57faa9b669.tar.gz |
.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/data.limg | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/shell/data.limg b/shell/data.limg index 4c9c21dc..772c9064 100644 --- a/shell/data.limg +++ b/shell/data.limg @@ -6,23 +6,19 @@ `(if ,cond ,body ()))]) (let . [(mac let (var val . body) `((fn (,var) ,@body) ,val))]) - (hline . [(def hline (fn (screen y color) - (hline1 screen y 0 (width screen) color)))]) (hline1 . [(def hline1 (fn (screen y x xmax color) (while (< x xmax) (pixel screen x y color) (set x (+ x 1)))))]) - (vline . [(def vline (fn (screen x color) - (vline1 screen x 0 (height screen) color)))]) (vline1 . [(def vline1 (fn (screen x y ymax color) (while (< y ymax) (pixel screen x y color) (set y (+ y 1)))))]) - (fill_rect . [(def fill_rect (fn (screen x1 y1 x2 y2 color) - (while (< y1 y2) - (hline1 screen y1 x1 x2 color) - (set y1 (+ y1 1)))))]) - (brline . [(def brline (fn (screen x0 y0 x1 y1 color) + (hline . [(def hline (fn (screen y color) + (hline1 screen y 0 (width screen) color)))]) + (vline . [(def vline (fn (screen x color) + (vline1 screen x 0 (height screen) color)))]) + (brline . [(def brline (fn (screen x0 y0 x1 y1 color) (let (x y) `(,x0 ,y0) (let dx (abs (- x1 x0)) (let dy (- 0 (abs (- y1 y0))) @@ -45,14 +41,24 @@ (if (<= e2 dx) dx 0))))))))))))))]) - (read_line . [(def read_line (fn (keyboard) + (read_line . [(def read_line (fn (keyboard) (let str (stream) (let c (key keyboard) (while (not (or (= c 0) (= c 10))) (write str c) (set c (key keyboard)))) str)))]) - (chessboard . [(def chessboard (fn (screen px) + (fill_rect . [(def fill_rect (fn (screen x1 y1 x2 y2 color) + (while (< y1 y2) + (hline1 screen y1 x1 x2 color) + (set y1 (+ y1 1)))))]) + (chessboard_row . [(def chessboard_row (fn (screen px y x xmax) + (while (< x xmax) + (fill_rect screen + x y + (+ x px) (+ y px) 15) + (set x (+ x (* px 2))))))]) + (chessboard . [(def chessboard (fn (screen px) (clear screen) (let xmax (width screen) (let ymax (height screen) @@ -62,13 +68,7 @@ (set y (+ y px)) (chessboard_row screen px y px xmax) (set y (+ y px)))))]) - (chessboard_row . [(def chessboard_row (fn (screen px y x xmax) - (while (< x xmax) - (fill_rect screen - x y - (+ x px) (+ y px) 15) - (set x (+ x (* px 2))))))]) - (brcircle . [(def brcircle (fn (screen cx cy r clr) + (brcircle . [(def brcircle (fn (screen cx cy r clr) (let x (- 0 r) (let y 0 (let err (- 2 (* 2 r)) @@ -88,7 +88,7 @@ (+ err (+ 1 (* 2 (set x (+ x 1))))))) (set continue (< x 0)))))))))]) - (main . [(def main (fn (screen keyboard) + (main . [(def main (fn (screen keyboard) (chessboard screen 16)))]) )) (sandbox . (brline screen 1 1 5 5 4)) |