Below you can find comparison Processing functions with Clojure2d.
Assuming that following variables are defined:
window
- display created with [[show-window]]cnvs
- canvas created with [[canvas]] inside drawing context (see [[with-canvas->]] or [[with-canvas]])And following namespaces are loaded:
(:require [clojure2d.core :refer :all] ;; generaral Clojure2d functions
[clojure2d.pixels :as p] ;; pixels operations
[clojure2d.color :as c] ;; color operations
[fastmath.core :as m] ;; general math functions
[fastmath.random :as r]) ;; random and noise
Processing | Clojure2d | Comments |
---|---|---|
draw() | Any function with following signature (fn [canvas window frame local-state] ...) attached to window created with [[show-window]] (:draw-fn key). | Such function is called before refresh of the display. Result is passed as local-state in the next call. |
exit() | [[close-window]] | Closes window programmatically. |
loop() | not implemented | possible in future versions |
noLoop() | not implemented | possible in future versions |
popStyle() | not implemented | |
pushStyle() | not implemented | |
redraw() | not implemented | not necessary |
setup() | Any function with following signature (fn [canvas window] ...) attached to window created with [[show-window]] (:setup key). | Returned value is treated as local-state for first call of drawing function. |
thread() | use future | |
all the rest | use Clojure |
Processing | Clojure2d | Comments |
---|---|---|
cursor() | not implemented | possible in future versions |
delay() | not implemented | use Thread/sleep |
displayDensity() | not implemented | |
focused | not implemented | possible in future versions |
frameCount | implemented | frame number is passed to the drawing function as third parameter |
frameRate() | implemented | set :fps key when [[show-window]] is called |
frameRate | not implemented | |
fullScreen() | not implemented | possible in future versions |
height | [[height]] | it's a function working on canvas/window/image |
noCursor() | not implemented | possible in future versions |
noSmooth() | implemented | use :low quality key in [[canvas]] call |
pixelDensity() | not implemented | for Retina use two times bigger canvas/window and call (scale canvas 2) . |
pixelHeight | not implemented | |
pixelWidth | not implemented | |
settings() | not necessary | |
size() | implemented | set size in [[canvas]] or [[show-window]] calls |
smooth() | implemented | use one of the keys defined in [[rendering-hints]] and pass to [[canvas]] or [[show-window]] |
width | [[width]] | it's a function working on canvas/window/image |
Use Clojure2d data types and functions
Use Clojure2d functions
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close