topical media & game development

talk show tell print

graphic-processing-learning-03-example-3-5-example-3-5.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 3-5: mousePressed and keyPressed
  void setup() {
    size(200,200);
    background(255);
  }
  
  void draw() {
   // Nothing happens in draw() in this example!
  }
  
  // Whenever a user clicks the mouse the code written inside mousePressed() is executed.
  void mousePressed() {
    stroke(0);
    fill(175);
    rectMode(CENTER);
    rect(mouseX,mouseY,16,16);
  }
  
  // Whenever a user presses a key the code written inside keyPressed() is executed.
  void keyPressed() {
    background(255);
  }
  


(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.