Anima

A microframework for drawing.

(load "anima.carp")
(use Anima)

(defn setup [rend]
  (framerate 0)) ; shortcut for a static sketch

(defn draw [rend]
  (do
    (color rend 255)
    (line rend 0 0 800 800)))

(defsketch "One line to rule them all" 800 800
  setup
  draw)

framerate

defn

(λ [Int] ())

                    (framerate n)
                

Set the framerate to n frames per second.

This will set a maximum, but cannot guarantee that exactly n frames can be produced per second.

hsb-to-rgb

defn

(λ [Int, Int, Int] (Array Int))

                    (hsb-to-rgb ih is ib)
                

Convert a three-component HSB color to an RGB color array.

line

defn

(λ [(Ptr SDL_Renderer), Int, Int, Int, Int] ())

                    (line rend ax ay bx by)
                

Draw a line from (ax, ay) to (bx, by).

point

defn

(λ [(Ptr SDL_Renderer), Int, Int] ())

                    (point rend x y)
                

Draw a point with (x, y) as its coordinates.

rand

defn

(λ [Int] Int)

                    (rand i)
                

Generate a random integer from 0 to i.

rect

defn

(λ [(Ptr SDL_Renderer), Int, Int, Int, Int] ())

                    (rect rend ax ay w h)
                

Draw a rectangle with (ax, ay) as origin, w as width, and h as height.

save

defn

(λ [(Ref SDLApp), (Ptr SDL_Renderer), Int, Int, String] ())

                    (save app rend w h filename)
                

Low-level function that saves the current application and renderer to a file of dimensions (w, h) to filename.