topical media & game development

talk show tell print

graphic-processing-learning-17-example-17-2-example-17-2.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 17-2: Text align 
  
  PFont f;
  
  void setup() {
    size(400,200);
    f = createFont("Arial", 16, true);
  }
  
  void draw() {
    background(255);
    stroke(175);
    line(width/2,0,width/2,height);
    textFont(f);
    fill(0);
    
    // textAlign() sets the alignment for displaying text. It takes one argument: CENTER, LEFT, or RIGHT.
    textAlign(CENTER);
    text("This text is centered." ,width/2,60);
    textAlign (LEFT) ;
    text("This text is left aligned." ,width/2,100);
    textAlign(RIGHT);
    text("This text is right aligned." ,width/2,140);
  }
  


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