topical media & game development

talk show tell print

graphic-processing-site-examples-Basics-Input-MousePress-MousePress.pde / pde



  
Click. Move the mouse to position the shape. Press the mouse button to invert the color.

  
  
  void setup() {
    size(200, 200);
    fill(126);
    background(102);
  }
  
  void draw() {
    if(mousePressed) {
      stroke(255);
    } else {
      stroke(0);
    }
    line(mouseX-66, mouseY, mouseX+66, mouseY);
    line(mouseX, mouseY-66, mouseX, mouseY+66); 
  }
  


(C) Æliens 20/2/2008

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.