Be a pro...grammer in two minutes
(I'm working on a better tutorial)
- In TextMate > Bundles > Processing, click on New Sketch, add the project name "mySketch" and click Create. TextMate will open the project, select mySketch.pde to start editing some code.
- OK! At the top of the document, type the word 'import' and hit your tab key, select the OpenGL library. The following will be inserted automatically by the bundle. This is called tab completion, this bundle has a bunch of them - the whole processing API and more!
import processing.opengl.*;
-
Add some more code:
import processing.opengl.*; void setup(){ size(300,300,OPENGL); println("Hello!"); } void draw(){ rect(0,0,40,40); }
- You have just created instructions to make a 40 pixel by 40 pixel rectangle at the top left corner. We've added the OpenGL mode just so I can tell you that all the core libraries are available for you to import. Save your file and in TextMate > Bundles > Processing, click on Run Sketch. You should see a new window popup with a white square on the top left corner.
- In TextMate > Bundles > Processing, click on View Log and you'll see the "Hello!" you instructed Processing to print.
- In TextMate > Bundles > Processing, click on Export Applet and a new folder, 'export', will appear in your sketch folder. In 'export', you'll find a version of your sketch you can upload to the web.
- OK, now that you are pro, go do your thang. You might be wondering where you can add additional libraries. Just create a new folder named "libraries" in /Users/[user]/Documents/Processing and dump them in there. And if you have assets you want to use, create a new folder name "data" in your sketch folder to house them.