xxxxxxxxxx
35
var info = 'click canvas and type some text';
var bob = '';
function setup() {
createCanvas(400, 400);
print(info);
}
function draw() {
background(200,200,0);
textSize(25);
strokeWeight(2);
stroke(0,0,200);
fill(200,0,0);
text(bob,20,40);
}
function keyTyped() {
if ( key > '' ) {
bob += key;
print("keyTyped "+key+" bob "+bob+" length "+bob.length);
}
//return false;
}
function keyPressed()
{
if (keyCode === ENTER||keyCode === RETURN) { bob = ''; }
else if ((keyCode === DELETE||keyCode === BACKSPACE)&&bob.length)
{ bob = bob.substring(0,bob.length-1); }
// else { bob += key; }
print("keyPressed "+key+" bob "+bob+" length "+bob.length);
//return false;
}