Page 152 - Hacking Roomba
P. 152

Chapter 7 — Making RoombaView                 133






































                             FIGURE 7-2: Processing on Windows


                             How Processing Works
                             Processing is implemented in Java. The simple commands that are part of the sketch are actu-
                             ally method names and variables of the Java class within which sketches run. The Processing
                             language is really no different from Java at all; it just removes the visible overhead and com-
                             plexity from Java.
                             So Processing is a Java IDE of sorts, albeit a simplified and specialized one. It enables you to
                             write quick graphical code sketches that respond to user input. For example, Listing 7-1 is the
                             entire code for a Processing sketch that creates a window, paints it gray, and then draws a blue
                             box that follows the user’s mouse.


                               Listing 7-1: Example Processing Sketch

                               void setup() {
                                 size(300,300);
                                 framerate(15);
                               }
                                                                                              Continued
   147   148   149   150   151   152   153   154   155   156   157