Processing > Texte
Contents (hide)
text("bonjour",x,y);
textAlign(CENTER/LEFT/RIGHT,CENTER/TOP/BOTTOM/BASELINE);
textWidth(String);
textSize(float);
Retour à la ligne | \n |
Tabulation | \t |
Apostrophe | \' |
Guillemets | \" |
Barre oblique inverse | \\ |
PFont police;
police = loadFont("police.vlw");
textFont(police,12);
text("bonjour la police",10,10);
// Creez la police (a partir du menu ''Tools -> Create Font'') et nommez la "police.vlw" PFont police; int taille; void setup() { [...] police = loadFont("police.vlw"); taille = 12; textFont(police,taille); [...] } void draw() { [...] text("bonjour",x,y); [...] }
String a = "WXYZ"; char caracteres[] = {'W', 'X', 'Y', 'Z'}; String b = new String(caracteres); String c = new String(caracteres,2,2);
String a = "WXYZ"; a.charAt(index) a.length() a.equals(String) String b = a.toUpperCase() String c = a + b //concaténation
String [] mots; int index; void setup() { size(400,400); smooth(); mots = new String[3]; mots[0] = "how"; mots[1] = "are"; mots[2] = "you?"; } void draw () { background(0); textAlign(CENTER); textSize(32); fill(255); text(mots[index],width/2,height/2); } void mousePressed() { index = index + 1; if ( index > 2 ) index = 0; }
String monmot = "time elapsed: "; void setup() { size(400,400); smooth(); } void draw () { background(0); textAlign(CENTER,CENTER); textSize(32); float w = textWidth(monmot+" "+millis()); rectMode(CENTER); fill(125); rect(width/2,height/2,w+20,100); fill(255); text(monmot+" "+millis(),width/2,height/2); }