04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The toolbar conveniently contains <strong>Processing</strong>’s six main control buttons. These buttons<br />

also have equivalent comm<strong>and</strong>s in the menu bar, which I’ll cover a bit later. These are not<br />

the only comm<strong>and</strong>s in the <strong>Processing</strong> application, but they are probably the most often<br />

used ones. From left to right, these buttons are Run, Stop, New, Open, Save, <strong>and</strong> Export.<br />

The following list describes the functions of each (when applicable, I’ve included the Mac<br />

<strong>and</strong> Windows keyboard shortcuts for each in parentheses after the button name):<br />

Run (Cmd+R on OS X; Ctrl+R on Windows): Compiles your code, launches a display<br />

window, <strong>and</strong> executes your sketch within this window.<br />

Stop: Terminates your running program, but leaves the display window open.<br />

THE PROCESSING ENVIRONMENT<br />

New (Cmd+N on OS X; Ctrl+N on Windows): Creates a new sketch within a new<br />

project directory. Both the directory <strong>and</strong> the PDE file (<strong>Processing</strong>’s own file format)<br />

will share this name. By default, new sketches are saved with the root sketch_, the<br />

date (in the form yy/mm/dd), <strong>and</strong> a secondary character beginning with the next<br />

alphabetically available character. For example, my current sketch is named<br />

sketch_051024a. If I save this sketch using this name, <strong>and</strong> then create a new sketch,<br />

that sketch will be named sketch_051024b; the next one will be sketch_051024c.<br />

Be aware that the default preference state in <strong>Processing</strong> is to delete empty<br />

sketches upon quit. Therefore, if you do not enter any code into the text editor<br />

window, you will not be able to actually save the project to disk—which I guess<br />

makes sense since there’s nothing to save in the file. If you want to change this setting,<br />

you can do so in the preferences, found under the <strong>Processing</strong> menu in OS X<br />

<strong>and</strong> the File menu in Windows.<br />

Open (Cmd+O on OS X; Ctrl+O on Windows): Displays a menu that lets you choose<br />

between opening a sketch residing on your local hard drive or across a network,<br />

through a st<strong>and</strong>ard file navigator; selecting from a list of available sketches, residing<br />

within your sketchbook location directory; or loading an example sketch that<br />

came bundled with the <strong>Processing</strong> software, from the examples directory residing<br />

within the main <strong>Processing</strong> directory. You can set the location of your sketchbook,<br />

where the sketches you create will reside, through the preferences—again found<br />

under the <strong>Processing</strong> menu in OS X <strong>and</strong> the File menu in Windows.<br />

Save (Cmd+S on OS X; Ctrl+S on Windows): Writes the current sketch to disk. You<br />

will not be prompted to confirm that you are writing over the previous state. If you<br />

want to keep your original sketch <strong>and</strong> also save the current one, you should use<br />

Save As, found under File menu. Again, please note that <strong>Processing</strong> requires sketch<br />

names to begin with a letter or underscore <strong>and</strong> contain no spaces. You may use<br />

numbers in the sketch name after the initial character, <strong>and</strong> sketch names should be<br />

no more than 64 characters in length. If you try to name a <strong>Processing</strong> sketch using<br />

an illegal character, <strong>Processing</strong> will bark at you <strong>and</strong> rename your file, converting the<br />

illegal character to an underscore.<br />

149<br />

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!