06.01.2013 Views

Learning Processing: A Beginner's Guide to Programming Images ...

Learning Processing: A Beginner's Guide to Programming Images ...

Learning Processing: A Beginner's Guide to Programming Images ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

398 <strong>Learning</strong> <strong>Processing</strong><br />

fi g. 21.2<br />

<strong>Processing</strong> au<strong>to</strong>-creates applications for three operating systems, Mac OS X, Windows, and Linux. If you<br />

Export Application from a Windows computer, the Mac application will not work properly (instructions<br />

for fi xing this issue are included in a readme.txt fi le that appears). To avoid this, simply Export<br />

Application on a Mac.<br />

Th e folder will contain all the fi les you need:<br />

• sketchName.exe (or named simply sketchName on Mac and Linux). This file is the double-clickable<br />

application.<br />

• “ source ” direc<strong>to</strong>ry . The application folder will include a direc<strong>to</strong>ry containing the source files for your<br />

program. This folder is not required <strong>to</strong> run the application.<br />

• “ lib ” . This folder only appears for Windows and Linux and contains required library files. It will always<br />

contain core.jar , the core processing library, as well as any others you import. On Mac OS X, the library<br />

files are visible by control-clicking the application file and selecting “ Show Package Contents. ”<br />

Th e user of your application will need Java installed on his or her computer in order for the application<br />

<strong>to</strong> run properly. On a Mac, Java comes preinstalled with the operating system, so you should not have<br />

any issues as long as the end user has not messed with their Java installation. On Windows, if this is<br />

a concern, you can include Java with the application by copying the “ Java ” folder from the <strong>Processing</strong><br />

direc<strong>to</strong>ry <strong>to</strong> the application folder (and you must be on a PC <strong>to</strong> do this).<br />

Th ere are a few tricks related <strong>to</strong> the Export Application feature. For example, if you want <strong>to</strong> have your own<br />

text in the title bar, you can add the following code <strong>to</strong> setup( ) .<br />

frame.setTitle( " My super-awesome application! " );<br />

In addition, although exported applications run in windowed mode (as opposed <strong>to</strong> “ present ” mode),<br />

you can set applications <strong>to</strong> run full screen by adding some code. Understanding the code requires some<br />

advanced knowledge of Java and the inner workings of <strong>Processing</strong> sketches.<br />

Some clues <strong>to</strong> this will be revealed in Chapter 23 , but for now this code is off ered simply <strong>to</strong> be copied:<br />

static public void main(String args[]) {<br />

PApplet.main(new String[] { " --present " , " SketchName " } );<br />

}

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

Saved successfully!

Ooh no, something went wrong!