about summary refs log tree commit diff stats
path: root/shell/data.limg
diff options
context:
space:
mode:
Diffstat (limited to 'shell/data.limg')
-rw-r--r--shell/data.limg48
1 files changed, 22 insertions, 26 deletions
diff --git a/shell/data.limg b/shell/data.limg
index dd40fbdc..f276e9b5 100644
--- a/shell/data.limg
+++ b/shell/data.limg
@@ -23,32 +23,28 @@
     (hline1 screen y1 x1 x2 color)
     (set y1 (+ y1 1)))))])
   (brline . [(def brline (fn (screen x0 y0 x1 y1 color)
-  ((fn (dx dy sx sy)
-     ((fn (err)
-        (brline1 screen x0 y0 x1 y1 dx dy sx sy err color))
-      (+ dx dy)))
-   (abs (- x1 x0))
-   (- 0 (abs (- y1 y0)))
-   (sgn (- x1 x0))
-   (sgn (- y1 y0)))))])
-  (brline1 . [(def brline1 (fn (screen x y xlast ylast dx dy sx sy err color)
-  (while (not (and (= x xlast) (= y ylast)))
+  (let (x y) `(,x0 ,y0)
+  (let dx (abs (- x1 x0))
+  (let dy (- 0 (abs (- y1 y0)))
+  (let sx (sgn (- x1 x0))
+  (let sy (sgn (- y1 y0))
+  (let err (+ dx dy)
+  (while (not (and (= x x1)
+                   (= y y1)))
     (pixel screen x y color)
-    ((fn (e2)
-       (if (>= e2 dy)
-         (set x (+ x sx))
-         ())
-       (if (<= e2 dx)
-         (set y (+ y sy)))
-       (set err (+ err
-            (+
-              (if (>= e2 dy)
-                dy
-                0)
-              (if (<= e2 dx)
-                dx
-                0)))))
-     (* err 2)))))])
+    (let e2 (* err 2)
+    (when (>= e2 dy)
+      (set x (+ x sx)))
+    (when (<= e2 dx)
+      (set y (+ y sy)))
+    (set err
+      (+ err
+         (+ (if (>= e2 dy)
+              dy
+              0)
+            (if (<= e2 dx)
+              dx
+              0))))))))))))))])
   (read_line_2 . [(def read_line_2 (fn (keyboard stream)
   ((fn (c)
      (if (= c 10)
@@ -97,5 +93,5 @@
   (main . [(def main (fn (screen keyboard)
   (chessboard screen 16)))])
   ))
-  (sandbox . (fill_rect screen 0 0 8 8 2))
+  (sandbox . (brline screen 1 1 5 5 4))
 )