xxxxxxxxxx
37
var inp;
var userText;
function setup() {
createCanvas(400, 400);
inp = createInput('');
inp.position(0, 0);
inp.size(100);
// inp.input(myInputEvent);
}
// function myInputEvent() {
// console.log('you are typing: ', this.value());
// }
function keyPressed() {
if (keyCode === ENTER) {
//when user hits enter, submit the box
submitText();
}
}
function submitText() {
// This function will be called when the Enter key is pressed
console.log("User entered!",inp.value());
userText = inp.value()
inp.value('')
}
function draw() {
background(220);
}