topical media & game development

talk show tell print

graphic-processing-algorithm-Ch10-p270-p270.pde / pde



  import processing.net.*; //get the net library
  Client MyClient; //define a client
  void setup(){
    size(300,300);
    MyClient = new Client(this, “127.0.0.1”, 5200);
  }
  void draw(){
    if(MyClient.available()>0){ //if data are available
      int x = MyClient.read(); //get the x-coordinate
      int y = MyClient.read(); //get the y-coordinate
      rect(x,y,5,5); //draw a rect at xy
      println(x+”, “+y); //print out coordinates
    }
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.