topical media & game development

talk show tell print

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



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 3-1: Zoog as dynamic sketch
  
  // setup() runs first one time.  
  // size() should always be first line of setup() since 
  // Processing wonÕt be able to do anything before the window size is specified.
  void setup() {
    // Set the size of the window
    size(200,200);  
  }
  
  // draw() loops continuously until you close the sketch window.
  void draw() {
    // Draw a white background
    background(255);   
    
    // Set CENTER mode
    ellipseMode(CENTER);
    rectMode(CENTER); 
  
    // Draw Zoog's body
    stroke(0);
    fill(150);
    rect(100,100,20,100);
  
    // Draw Zoog's head
    stroke(0);
    fill(255);
    ellipse(100,70,60,60); 
  
    // Draw Zoog's eyes
    fill(0); 
    ellipse(81,70,16,32); 
    ellipse(119,70,16,32);
  
    // Draw Zoog's legs
    stroke(0);
    line(90,150,80,160);
    line(110,150,120,160);
  }
  


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