Skip to content

processing-cpp/processing.cpp

Repository files navigation

processing.cpp

C++ Mode for Processing. Write sketches with setup() and draw() inside the Processing IDE, or drop the engine into your own C++ project and use the same API from your own editor and build system.


Two ways to use it

1. Inside the Processing IDE

If you know Processing, this is the fastest way in. Install C++ Mode through the Contribution Manager, select it from the mode dropdown, and write sketches exactly like you normally would. They compile to native C++ instead of Java, but the workflow is identical.

Install:

  1. Open Processing
  2. Click the mode dropdown (top right, says Java by default) → Add Mode...
  3. Search for C++ Mode and click Install
  4. Restart Processing, select C++ from the mode dropdown
void setup() {
    size(640, 360);
}

void draw() {
    background(20);
    fill(255, 140, 0);
    circle(mouseX, mouseY, 40);
}

2. As a standalone header library

Use the Processing-style API in any C++ project without opening the Processing IDE. Two packaging options:

Drag-and-drop — unzip, drop two files next to your source, compile:

#include "Processing.h"

struct Sketch : public Processing::PApplet {
    void settings() override { size(640, 360); }
    void setup()    override { background(0); }
    void draw()     override {
        background(0);
        fill(255, 140, 0);
        circle(mouseX, mouseY, 40);
    }
};

int main() {
    Sketch sketch;
    sketch.run();
}
g++ -std=c++17 main.cpp Processing.cpp -o sketch && ./sketch

CMake — add as a subdirectory and link:

add_subdirectory(processing-cpp)
target_link_libraries(your_target PRIVATE processing_cpp)

Downloads

Get the latest release from the releases page:

  • processing-cpp-dragdrop.zip — drag-and-drop version
  • processing-cpp-cmake.zip — CMake version

Requirements

Windows

MSYS2 with MinGW 64-bit. Install once:

pacman -S --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-glfw mingw-w64-x86_64-glew

Always build from the MSYS2 MinGW 64-bit terminal, not PowerShell or Command Prompt.

macOS

Xcode command line tools and Homebrew:

xcode-select --install
brew install glfw glew

Linux

# Ubuntu / Debian
sudo apt install g++ libglfw3-dev libglew-dev

# Arch
sudo pacman -S gcc glfw glew

Documentation

Full reference and tutorials at processing-cpp.github.io


License

LGPL-2.1

About

Mode to write Processing, C++

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors