Page 151 - Hacking Roomba
P. 151
132 Part II — Fun Things to Do
Processing is an application for Windows, Mac OS X, or Linux. When first run, it presents a
simple text-editing window, with a few controls on top. Figure 7-1 shows what it looks like on
Mac OS X; Figure 7-2 shows it on Windows. The interface is identical, save for the platform-
specific menu items. The Linux version looks almost identical to the Windows version.
In the text-editing window, you write your sketch. A sketch consists of a list of Java-like com-
mands like line() to draw lines, ellipse() to draw ellipses, and text() to draw text. A
sketch can create either static graphics or dynamic animations that respond to user input.
FIGURE 7-1: Processing on Mac OS X
The sketch can then be run by clicking the Run button (right-pointing arrow button) and
stopped with Stop (square box icon button). If there are syntax problems with the sketch, they
will be described in the black status window at the bottom and highlighted in the sketch win-
dow. A sketch can be saved, named, and reloaded, just like with any text editor. When you’re
happy with the sketch, you can export it as a web page with embedded applet. You can also
export it as an application, and Processing will create true executables for all three operating
systems.
In many ways, Processing is a descendant of the Logo programming language. Both are visually
focused and provide a number of functions to make drawing graphics easier. However, Processing
can do much more. It can operate in 3D, work with video and sound, talk over the Internet and
MIDI, perform physics simulations, and do many other things. It’s continuously being expanded
and improved through libraries created by anyone with a good idea.