Here is a very, very simple example of an interactive “shape typer” – no classes, just a core concept.
/**
* SimpleShapeTyper
* 2019-04 Processing 3.4
* discourse.processing.org/t/process-text-as-shapes/10006/4
**/
PVector cursor;
int dim = 20;
void setup() {
cursor = new PVector(0, 0);
}
void draw() {
}
void keyPressed() {
if (key%2==0) {
rect(cursor.x, cursor.y, dim, dim);
} else {
ellipse(cursor.x+dim/2, cursor.y+dim/2, dim, dim);
}
cursor.add(dim, 0);
if (cursor.x >= width) {
cursor.add(-cursor.x, dim);
}
if (cursor.y >= height) {
cursor.set(0, 0);
background(192);
}
}