Custom default content for a new sketch

edited April 2017 in Using Processing

Hello!

Is it possible to make a new sketch contain some code by default? I find myself writing some modes and functions almost every time, like pixelDensity(displayDensity()) and a HSL color function. This would enable me to focus more on art and less on setting up an environment.

I read through preferences.txt and I could not find anything like this. I expected I could choose a file to be the default sketch (just like you can choose the sketchbook location).

Of course, I can work around this by manually copy pasting the code from a file. I am using Processing 3.3

Comments

  • edited April 2017

    @felixblade -- see Templates in Processing 3.2+:

    Starting with Processing 3.2, a templates directory has been added to the sketchbook. If you'd like to have a standard set of code that shows up every time you create a new sketch, you can add files there.

    You can have one template per Mode. To set your default template for Java Mode, for instance, create a directory called Java inside the templates directory in your sketchbook. Inside that Java directory, create a file called sketch.pde. Next time you create a new sketch, all files from the Java directory will be copied to your new sketch, and the sketch.pde file will be used to create yoursketchname.pde.

Sign In or Register to comment.