1
0

gfxtest.l 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. (def ofs 0)
  2. (def x1 0)
  3. (def x2 0)
  4. (def y1 0)
  5. (def y2 0)
  6. (def fb (mmap "/framebuffer"))
  7. (def f (open "/framebuffer"))
  8. (def color 0xffffff)
  9. (def line (fn x y w (do
  10. (def x1 (* 4 x))
  11. (def x2 (* 4 (+ x w)))
  12. (def ofs (* y 7680))
  13. (while (lt x1 x2) (do (def x1 (+ x1 4)) (put32 fb (+ ofs x1) color)))
  14. )))
  15. (def box (fn x y sz (do
  16. (def y1 y)
  17. (def y2 (+ y sz))
  18. (while (lt y1 y2) (do (def y1 (+ y1 1)) (line x y1 sz)))
  19. (gc)
  20. )))
  21. (def box-size 2)
  22. (def main (fn (do
  23. (def box-size 2)
  24. (def color 0)
  25. (box 0 0 100)
  26. (box 100 100 100)
  27. (box 200 0 100)
  28. (box 300 100 100)
  29. (box 0 200 100)
  30. (box 200 200 100)
  31. (while (lt box-size 50)
  32. (do
  33. (def color 0xffffff)
  34. (def box-size (+ box-size 1))
  35. (box 0 0 box-size)
  36. (box 100 100 box-size)
  37. (def color 0xff00ff)
  38. (box 200 0 box-size)
  39. (def color 0x00ff00)
  40. (box 300 100 box-size)
  41. (def color 0x00ffff)
  42. (box 0 200 box-size)
  43. (def color 0xffff00)
  44. (box 200 200 box-size)
  45. (send f 0)))
  46. )))