Getting Started
Create your first sketch with C++ Mode, from opening Processing to seeing something on screen.
Don't have Processing yet?
C++ Mode runs inside the Processing IDE. Install Processing itself first, then come back here.
1. Install C++ Mode
Open Processing, click the mode dropdown in the top-right of the editor, choose Add Mode..., then search for C++ Mode in the Contribution Manager and click Install.
Full walkthrough with screenshots: see Looking for the C++ Mode? on the Downloads page.
2. Open a new sketch
Restart Processing, open the mode dropdown again, and select C++.
You'll see a blank editor, just like Java mode. This is where you'll write your sketch.
3. Write your first sketch
Every sketch has two functions: setup() runs once when the sketch starts, and draw() runs over and over, once per frame. Type this into the editor:
void setup() {
size(640, 360);
}
void draw() {
background(20);
ellipse(mouseX, mouseY, 40, 40);
}
size() sets the window dimensions. background() clears the frame to a color each time it's drawn. ellipse() draws a circle that follows wherever the mouse is, using the built-in mouseX and mouseY variables.
4. Run it
Click the Run button (the play icon) in the top-left of the editor, or press Ctrl+R (Cmd+R on Mac).
A window opens with a dark gray background. Move your mouse over it and a circle follows the cursor.
That's a complete sketch. Under the hood it's compiling to real C++ and running natively, but everything about writing it looks and feels like any other Processing mode.