Processing.Org - Language

Miscellaneous Forums/General Discussion/Processing.Org - Language

Anybody had experience with this language? - http://www.processing.org

The language appears to be Java'ish and looks fairly straight-forward
There are some nice commands/functions avaialable too - http://www.processing.org/reference/index.html

Speed-wise, I don't know how it stands up
I'm dabbling with the Mobile version at the moment

some of the command names are slightly parculiar:

fill() - sets the fill color (rather than performing a 'fill')
stroke() - turns on the shape border rendering


Example code
PImage bg;
int a; 

void setup() 
{
  size(200,200);
  frameRate(30);
  // The background image must be the same size as the parameters
  // into the size() method. In this program, the size of "milan_rubbish.jpg"
  // is 200 x 200 pixels.
  bg = loadImage("milan_rubbish.jpg");
}

void draw() 
{
  background(bg);

  a = (a + 1)%(width+32);
  stroke(226, 204, 0);
  line(0, a, width, a-26);
  line(0, a-6, width, a-32);
}


I've had some experience in it in a university class. Was the language used for our graphics programming assignments. From my understanding processing IS Java (or at the very least translated to Java at compile time), just with some libraries tacked on.

supposedly made with processing:
http://www.youtube.com/watch?v=2Ug7ABWE5js&eurl=http://jqln.org/blog/

Experience with it was pretty nice. For quick prototyping it was really easy to get things up on the screen and then going back to the IDE and editing the code. Very quick feedback.

I would never think to use it to develop a desktop game, but mobile sounds like an interesting venture.

> but mobile sounds like an interesting venture

I just knocked up a simple program to test on a mobile phone and it worked very well indeed. I only had to copy across the exported *.JAR file

int x, y;
int xdir=0 , ydir=-8;
int r=50,g=100,b=30;
int rdir=4,gdir=-4,bdir=-4;

void setup() {
  softkey("Clear");
  x = width / 2;
  y = height -16;
    framerate(10);
}

void draw() {
  updatecolor();
  updatepos();
  rect(x-4,y-4,8,8);
}

void updatecolor(){
  if (r+rdir<0|r+rdir>255){
    rdir=-rdir;
  }
  if (g+gdir<0|g+gdir>255){
    gdir=-gdir;
  }
  if (b+bdir<0|b+bdir>255){
    bdir=-bdir;
  }
  r+=rdir ; g+=gdir ; b+=bdir;
  fill(color(r,g,b));
}

void updatepos(){
  if (x>width){
    x=0;
  }
  if (x<0){
    x=width;
  }
  if (y>height){
    y=0;
  }
  if (y<0){
    y=height;
  }  
  x+=xdir ; y+=ydir;
}


void keyPressed(){
  switch (keyCode) {
    case UP:
      ydir = -8 ; xdir=0;
      break;
   case DOWN:
      ydir = 8 ; xdir=0;
      break;
   case LEFT:
      xdir = -8 ; ydir=0;
      break;
   case RIGHT:
      xdir = 8 ; ydir=0;
      break;
   }
}

void softkeyPressed(String label) {
  if (label.equals("Clear")) {
    background(200);
  }  
}


The program also generates applets complete with an index.htm page showing the results. Good stuff!

Handy for quick prototypes and data visualization. Very handy serial libs for interfacing a PC to a micro controller, which is what I use it for :) It is really, really easy to use.
Do all your setup and then run everything in a Draw{} loop.
Easier than any basic imo.

Cool :)

I've only done some smaller stuff in processing. I like it beside of that it's not hw accelerated and well Java like syntax but they have some effective and simple commands.

The good thing too is, there are lots of examples supplied with the program (including some nice OpenGL stuff)

That code certainly is not Java: For starters, there are no classes and no exceptions that need to be caught. It looks more like an Ecmascript-based language like Actionscript or Javascript. And I keep wondering why everybody uses an ugly curly-braces-language instead of something more elegant like Python (or Pascal).

Me too. It's 2008 and language designers are still in love with ; and require it placing at the end of every line(?!) .. grr
We might as well go back to individually numbering the lines too like 'good old days'

I can live with the {} though since they universal for commands like FOR / IF / WHILE / FUNCTIONS / CLASSES


Python as a nice approach which relies on tabbed-out code for the compiler to identify the blocks. Although, its very picky. If something does not align exactly the interpreter will complain