Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make cheatsheet more complete.

  • Loading branch information...
commit 58257898a89f16aea50445cd3bcb1910668677ff 1 parent be52303
@samaaron samaaron authored
View
BIN  docs/cheatsheet/cheat-sheet.pdf
Binary file not shown
View
52 docs/cheatsheet/cheat-sheet.tex
@@ -77,7 +77,7 @@
{\Large{\textbf{Processing-core Cheat Sheet 1.0.0}}}
-\colouredbox{pink}{
+\colouredbox{blue2}{
\section{Color}
\begin{tabularx}{\hsize}{lX}
Creating \& Reading & \cmd{alpha blend-color blue brightness color color-mode green hue lerp-color red saturation } \\
@@ -86,19 +86,19 @@
Setting & \cmd{background background-float background-image background-int fill fill-float fill-int no-fill no-stroke stroke stroke-float stroke-int } \\
\end{tabularx}
}
-\colouredbox{blue2}{
+\colouredbox{yellow}{
\section{Data}
\begin{tabularx}{\hsize}{lX}
Conversion & \cmd{binary hex unbinary unhex } \\
\end{tabularx}
}
-\colouredbox{yellow}{
+\colouredbox{purple}{
\section{Environment}
\begin{tabularx}{\hsize}{lX}
& \cmd{current-frame-rate cursor cursor-image focused frame-count frame-rate height no-cursor screen-height screen-width width } \\
\end{tabularx}
}
-\colouredbox{purple}{
+\colouredbox{green}{
\section{Image}
\begin{tabularx}{\hsize}{lX}
& \cmd{create-image } \\
@@ -115,7 +115,7 @@
Time \& Date & \cmd{day hour millis minute month seconds year } \\
\end{tabularx}
}
-\colouredbox{green}{
+\colouredbox{pink}{
\section{Lights, Camera}
\begin{tabularx}{\hsize}{lX}
Camera & \cmd{begin-camera camera end-camera frustum ortho perspective print-camera print-projection } \\
@@ -124,7 +124,7 @@
Material Properties & \cmd{ambient ambient-float ambient-int emissive emissive-float emissive-int shininess specular } \\
\end{tabularx}
}
-\colouredbox{red}{
+\colouredbox{blue}{
\section{Math}
\begin{tabularx}{\hsize}{lX}
Calculation & \cmd{abs abs-float abs-int ceil constrain constrain-float constrain-int dist exp lerp log mag map-range norm pow round sq sqrt } \\
@@ -132,7 +132,7 @@
Trigonometry & \cmd{acos asin atan atan2 cos degrees radians sin tan } \\
\end{tabularx}
}
-\colouredbox{blue}{
+\colouredbox{yellow}{
\section{Output}
\begin{tabularx}{\hsize}{lX}
Files & \cmd{begin-raw begin-record create-output end-raw end-record } \\
@@ -145,7 +145,7 @@
& \cmd{create-graphics hint } \\
\end{tabularx}
}
-\colouredbox{pink}{
+\colouredbox{red}{
\section{Shape}
\begin{tabularx}{\hsize}{lX}
2D Primitives & \cmd{arc ellipse line point quad rect triangle } \\
@@ -156,20 +156,26 @@
Vertex & \cmd{begin-shape bezier-vertex curve-vertex end-shape texture texture-mode vertex } \\
\end{tabularx}
}
-\colouredbox{blue2}{
+\colouredbox{green}{
+ \section{State}
+ \begin{tabularx}{\hsize}{lX}
+ & \cmd{set-state! state } \\
+ \end{tabularx}
+}
+\colouredbox{blue}{
\section{Structure}
\begin{tabularx}{\hsize}{lX}
& \cmd{delay-frame exit no-loop pop-style push-style redraw start-loop } \\
\end{tabularx}
}
-\colouredbox{yellow}{
+\colouredbox{pink}{
\section{Transform}
\begin{tabularx}{\hsize}{lX}
& \cmd{apply-matrix pop-matrix print-matrix push-matrix reset-matrix rotate rotate-x rotate-y rotate-z scale shear-x shear-y translate } \\
Utility Macros & \cmd{with-rotation with-translation } \\
\end{tabularx}
}
-\colouredbox{purple}{
+\colouredbox{yellow}{
\section{Typography}
\begin{tabularx}{\hsize}{lX}
Attributes & \cmd{text-align text-leading text-mode text-size text-width } \\
@@ -178,6 +184,30 @@
\end{tabularx}
}
+\colouredbox{blue2}{
+ \section{Applet}
+ \begin{tabularx}{\hsize}{lX}
+ Creation & \cmd{applet defapplet} \\
+ Control & \cmd{applet-stop applet-start applet-exit applet-close} \\
+ Config Keywords & \cmd{:title :size} \\
+ Draw Callback Keywords & \cmd{:setup :draw} \\
+ Mouse Callback Keywords & \cmd{:mouse-pressed :mouse-released :mouse-moved :mouse-dragged :mouse-entered :mouse-exited :mouse-clicked} \\
+ Keyboard Callback Keywords & \cmd{:key-pressed :key-released :key-typed } \\
+ Window Callback Keywords & \cmd{:focus-gained :focus-lost} \\
+ \end{tabularx}
+}
+
+
+\colouredbox{grey}{
+ \section{Reflection}
+ \begin{tabularx}{\hsize}{lX}
+API Exploration & \cmd{doc-cats doc-fns doc-meths} \\
+Version & \cmd{processing-version} \\
+ \end{tabularx}
+}
+
+
+
\begin{flushright}
\footnotesize
\rule{0.7\linewidth}{0.25pt}
View
161 docs/cheatsheet/cheat_sheet_gen.clj
@@ -0,0 +1,161 @@
+(ns docs.cheat-sheet-gen
+ (:require [processing.core]))
+
+(def cheat-sheet-start
+ "
+\\documentclass[footexclude,twocolumn,DIV40,fontsize=8.7pt]{scrreprt}
+
+% Author: Sam Aaron
+% Comments, errors, suggestions: sam.aaron(at)gmail.com
+
+% Based on Steve Tayon's excellent Clojure Cheat Sheet
+
+% License
+% Eclipse Public License v1.0
+% http://opensource.org/licenses/eclipse-1.0.php
+
+% Packages
+\\usepackage[utf8]{inputenc}
+\\usepackage[T1]{fontenc}
+\\usepackage{textcomp}
+\\usepackage[english]{babel}
+\\usepackage{tabularx}
+\\usepackage{lmodern}
+\\renewcommand*\\familydefault{\\sfdefault}
+
+
+\\usepackage[table]{xcolor}
+
+% Set column space
+\\setlength{\\columnsep}{0.25em}
+
+% Define colours
+\\definecolorset{hsb}{}{}{red,0,.4,0.95;orange,.1,.4,0.95;green,.25,.4,0.95;grey,0.0,0.0,0.1;yellow,.15,.4,0.95}
+
+\\definecolorset{hsb}{}{}{blue,.55,.4,0.95;purple,.7,.4,0.95;pink,.8,.4,0.95;blue2,.58,.4,0.95}
+
+\\definecolorset{hsb}{}{}{magenta,.9,.4,0.95;green2,.29,.4,0.95}
+
+% Redefine sections
+\\makeatletter
+\\renewcommand{\\section}{\\@startsection{section}{1}{0mm}
+ {-1.7ex}{0.7ex}{\\normalfont\\large\\bfseries}}
+\\renewcommand{\\subsection}{\\@startsection{subsection}{2}{0mm}
+ {-1.7ex}{0.5ex}{\\normalfont\\normalsize\\bfseries}}
+\\makeatother
+
+% No section numbers
+\\setcounter{secnumdepth}{0}
+
+% No indentation
+\\setlength{\\parindent}{0em}
+
+% No header and footer
+\\pagestyle{empty}
+
+
+% A few shortcuts
+\\newcommand{\\cmd}[1] {\\frenchspacing\\texttt{\\textbf{{#1}}}}
+\\newcommand{\\cmdline}[1] {
+ \\begin{tabularx}{\\hsize}{X}
+ \\texttt{\\textbf{{#1}}}
+ \\end{tabularx}
+}
+
+\\newcommand{\\colouredbox}[2] {
+ \\colorbox{#1!40}{
+ \\begin{minipage}{0.95\\linewidth}
+ {
+ \\rowcolors[]{1}{#1!20}{#1!10}
+ #2
+ }
+ \\end{minipage}
+ }
+}
+
+
+%%%%%%%% BEGIN DOC %%%%%%%%%%%%
+
+\\begin{document}
+
+ {\\Large{\\textbf{Processing-core Cheat Sheet 1.0.0}}}
+
+")
+
+(def cheat-sheet-end
+ "
+ \\begin{flushright}
+ \\footnotesize
+ \\rule{0.7\\linewidth}{0.25pt}
+ \\verb!$Revision: 1.0.0.0, $Date: 4th March, 2012!\\\\
+ \\verb!Sam Aaron (sam.aaron gmail com)!
+ \\end{flushright}
+
+\\end{document}
+
+
+")
+
+(def cheat-sheet-applet
+ "
+\\colouredbox{blue1}{
+ \\section{Applet}
+ \\begin{tabularx}{\\hsize}{lX}
+ Creation & \\cmd{applet defapplet} \\\\
+ Control & \\cmd{applet-stop applet-start applet-exit applet-close} \\\\
+ Config Keywords & \\cmd{:title :size} \\\\
+ Draw Callback Keywords & \\cmd{:setup :draw} \\\\
+ Mouse Callback Keywords & \\cmd{:mouse-pressed :mouse-released :mouse-moved :mouse-dragged :mouse-entered :mouse-exited :mouse-clicked} \\\\
+ Keyboard Callback Keywords & \\cmd{:key-pressed :key-released :key-typed } \\\\
+ Window Callback Keywords & \\cmd{:focus-gained :focus-lost} \\\\
+ \\end{tabularx}
+}
+")
+
+(def cheat-sheet-docs
+ "
+\\colouredbox{grey}{
+ \\section{Reflection}
+ \\begin{tabularx}{\\hsize}{lX}
+API Exploration & \\cmd{doc-cats doc-fns doc-meths} \\\\
+Version & \\cmd{processing-version} \\\\
+ \\end{tabularx}
+}
+
+")
+
+(defn cheat-sheet-dynamic
+ []
+ (let [colours (cycle ["blue2" "yellow" "purple" "green" "orange" "pink" "blue" "yellow" "grey" "red" "green" "blue" "pink" "yellow"])
+ info (#'processing.core/sorted-category-map)
+ clean (fn [s] (.replaceAll s "&" "\\\\&"))]
+ (dorun
+ (map (fn [[cat-idx cat-info] colour]
+ (println (str "\\colouredbox{" colour "}{"))
+ (println (str " \\section{"(clean (:name cat-info)) "}"))
+ (println " \\begin{tabularx}{\\hsize}{lX}")
+ (when (> (count (:fns cat-info)) 0)
+ (print (str " & \\cmd{" ))
+ (dorun (map (fn [f] (print f " ")) (:fns cat-info)))
+ (println "} \\\\"))
+ (dorun
+ (map (fn [[subcat-idx {:keys [name fns]}]]
+ (when (> (count fns) 0)
+ (print (str " " (clean name) " & \\cmd{" ))
+ (dorun (map (fn [f] (print f " ")) fns))
+ (println "} \\\\")))
+ (:subcategories cat-info)))
+ (println " \\end{tabularx}")
+ (println "}"))
+ info colours))))
+
+
+
+(defn mk-cheat-sheet
+ []
+ (println cheat-sheet-start)
+ (cheat-sheet-dynamic)
+ (println cheat-sheet-applet)
+ (println cheat-sheet-docs)
+ (println cheat-sheet-end)
+)
View
4 src/processing/core.clj
@@ -22,6 +22,8 @@
(defn
^{:requires-bindings true
+ :category "State"
+ :subcategory nil
:added "1.0"}
state
"Retrieve canvas-specific state by key. Must initially call
@@ -40,6 +42,8 @@
(defn
^{:requires-bindings true
+ :category "State"
+ :subcategory nil
:added "1.0"}
set-state!
"Set canvas-specific state. May only be called once (ideally in the
Please sign in to comment.
Something went wrong with that request. Please try again.