Skip to content

Instantly share code, notes, and snippets.

@AeroNotix
Created February 10, 2016 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AeroNotix/955fdf85e099e1ff3b10 to your computer and use it in GitHub Desktop.
Save AeroNotix/955fdf85e099e1ff3b10 to your computer and use it in GitHub Desktop.
(ql:quickload :lispbuilder-sdl)
(defvar *SIZE* 800)
(defvar *SHADES* 50)
(defvar *STEP* (/ *SIZE* *SHADES*))
(defvar *COL* 0)
(defun box (n)
(cond ((>= n *SHADES*) nil)
((< n *SHADES*)
(progn
(setq *COL* (/ (* n 255) *SHADES*))
(sdl:draw-box-* (* *STEP* n) 0 *STEP* *SIZE*
:color (sdl:color :r *COL* :g *COL* :b *COL*))
(box (+ n 1))))))
(sdl:with-init ()
(sdl:window *SIZE* *SIZE* :title-caption "50 . Shades of Grey")
(setf (sdl:frame-rate) 60)
(sdl:with-events ()
(:quit-event () t)
(:key-down-event () (sdl:push-quit-event))
(:idle ()
(sdl:clear-display sdl:*black*)
(box 0)
(sdl:update-display))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment