You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following describes how to set up a Processing library project in Gradle, build it successfully, use IntelliJ IDEA for development/debugging of the library, and to make your library ready for distribution.
Create a new project in IntelliJ with the name and location of your choice, for example lib-dev. This project is where you can create new Processing examples to test your library.
Create a new module in the project to import the core of Processing, for example in a name processing-core, using the core folder under the processing4 repo as the content root and module file location. As "JARs or Directory" dependency of this module, add <path to processing4 repo>/core/library. Make sure to use IntelliJ as the Build System.
Create another module in the project, this time for YourLibrary. This is the Processing library project you have been working on, in this case, this repository. Use the root folder of YourLibrary, or processing-library-template-gradle, as the content root and module file location. Add the processing-core module as a module dependency for this module.
Add the processing-core and YourLibrary modules as module dependencies to the main module of the project (lib-dev).
Add the libs subdirectory inside the YourLibrary directory (it should have been created during the library building step in the above section) as a "JARs or Directory" dependency of the main module, lib-dev.
You can now create a test program under the src folder of the main module of the lib-dev project:
import processing.core.*; // import processing core
import template.library.*; // import sample library
public class HelloTest extends PApplet {
HelloLibrary hello;
public void settings() {
size(parseInt(args[0]), parseInt(args[1]));
smooth();
}
public void setup() {
hello = new HelloLibrary(this);
PFont font = createFont("Arial", 40);
textFont(font);
}
public void draw() {
background(0);
fill(255);
text(hello.sayHello(), 40, 200);
}
static public void main(String[] args) {
PApplet.main(HelloTest.class, "400", "400");
}
}
You should be able to run the program from the IntelliJ IDE.
Please note that any file read from the IntelliJ program should be placed inside the subdirectory data located inside the root of the IntelliJ project (i.e.: lib-dev/data)