Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Tuesday, 12 November 2013

Working towards returning ruby-processing to gem distribution by rubygems.org

I have made the first steps toward returning ruby-processing to rubygems distribution. See my fork on github. This is work in progress, however it does work on Archlinux, and also should also work on the MAC, where the path to the processing jars should be stable?

  1. Install processing-2.1.0 (for your OS)
  2. Create or edit the YAML .rp5rc file to point to processing-root possibly using the sketch below (in the processing ide) config.pde
  3. Clone my fork
  4. cd ruby-processing (or whatever you call it)
  5. rake (MAC and linux) to see if tests work
  6. gem install ruby-processing-{version}.gem for more comprehensive testing
Currently for ease of testing we still include jruby-complete download as option, but it is not required for many sketches, intention is it will be available as a post install option.
String processingRoot = "enter your processing root here"; // edit this line in the sketch
String home;
PFont font;

void setup() {
  size(400, 200);
  font = createFont("Helvetica", 18);
  home = System.getProperty("user.home");

void draw() {
  fill(255, 0, 0);
  textFont(font, 18);
  // this adds a blinking cursor after your text, at the expense of redrawing everything every frame
  text(processingRoot+(frameCount/10 % 2 == 0 ? "_" : ""), 35, 45);

void keyReleased() {
  if (key != CODED) {
    switch(key) {
    case BACKSPACE:
      processingRoot = processingRoot.substring(0, max(0, processingRoot.length()-1));
    case ENTER:   // save the processing root to the config file
    case RETURN:
      PrintWriter pw = createWriter(home + "/.rp5rc");
      pw.write("PROCESSING_ROOT: \"" + processingRoot + "\"");
    case ESC:
    case DELETE:
      processingRoot += key;

No comments:

Post a Comment


Blog Archive

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby- and processing-3.2.2