Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug in Processing Development Environment (PDE), Also is there a plugin to support intellisense

Tags:

processing

I am new to Processing development environment, I did my homework and all I found is to import processing libraries into Java IDE (eclipse) and use debugging, I am wondering if there is a PDE plugin that can help with intellisense and debugging as for small sketches PDE is very convenient.

like image 463
Swathi Avatar asked Feb 13 '13 04:02

Swathi


1 Answers

Debugging

Since the launch of Processing 3, debugging is now a native feature of the Processing IDE.

In the screenshot below, you'll see a new Debug menu. I set breakpoints on the setup() and draw() methods as indicated by the <> marks in the line numbers. To the right is a popout window listing variable and object values, etc.

enter image description here

Intellisense

From the Preferences menu, check the box Code completion with Ctrl-space.

enter image description here

Then, you can start typing a function like ellipse and press CTRL+Space to pop intellisense. Moreover, with that turned on, accessing properties or methods of an object by typing a . after should automatically pop intellisense.

Using Another IDE

Finally, you could take advantage of a more powerful IDE by importing the processing core.jar into any Java project. The core.jar file is located relative to your Processing installation, such as:

OSX: /Applications/Processing 3.0.1.app/Contents/Java/core/library/core.jar
Windows: \Program Files\processing-3.0.2\core\library\core.jar

In Processing 1 and 2, this must be run as Applet. In Processing 3, run as Java Application. Here's an example to demonstrate:

import processing.core.*;

public class Main extends PApplet {

    // In Eclipse, run this project as Java Application (not Applet)
    public static void main(String[] args) {
        String[] a = {"MAIN"};
        PApplet.runSketch(a, new Main());
    }

    public void settings() { // <-- that's different
        size(500, 500); // necessary here to prevent runtime IllegalStateException
    }

    public void setup() {
        // other one and done operations
    }

    public void draw() {
        ellipse(mouseX, mouseY, 40, 40);
    }
}

Check out this post if you want to write Processing code in Eclipse across multiple classes.
https://processing.org/tutorials/eclipse/

like image 52
ThisClark Avatar answered Nov 01 '22 04:11

ThisClark