Skip to content

Commit

Permalink
clean up hline and vline
Browse files Browse the repository at this point in the history
  • Loading branch information
akkartik committed May 7, 2021
1 parent 74be534 commit c651bbe
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions shell/data.limg
Expand Up @@ -4,18 +4,18 @@
`(def ,name (litmac litfn () ,params ,@body))))])
(when . [(mac when (cond body)
`(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 lo hi color)
(while (< lo hi)
(pixel screen lo y color)
(set lo (+ lo 1)))))])
(let (x xmax) `(0 ,(width screen))
(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 lo hi color)
(while (< lo hi)
(pixel screen x lo color)
(set lo (+ lo 1)))))])
(let (y ymax) `(0 ,(height screen))
(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)
Expand Down

0 comments on commit c651bbe

Please sign in to comment.