Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PFont f;
- float a = 'b';
- //variable to store text as it is being typed
- String typing = "";
- //a different variable to store the text when enter is pressed
- String saved = "";
- void setup() {
- size (700, 500);
- f = loadFont ("ArialMT-16.vlw");
- } //close setup brackets
- void draw() {
- background (226, 197, 247); //purple background
- int indent = 50;
- //if (keyPressed = 'a') {
- // typing = 'b';
- //}
- //set font and font color
- textFont (f);
- fill(0); //black text
- //Display everything
- text ("Program intent: \nI wanted to play with the pointillize function. \nI was curious how an image would turn out if I added a stroke weight to each of the points. \nI also wanted to start playing with text, which is why I chose to run my directions in this program. \nThis program is also interactive! \nType in the box \nIf you mess up, oh well. Apparently backspace isn't an option right now. ",indent,40);
- text (typing, indent, 300);
- text (saved, indent, 200);
- }
- void keyPressed() {
- //If the return key is pressed, save the String and clear it
- if (key == '\n') {
- saved = typing;
- typing = "";
- //otherwise, concatenate the string
- } else {
- typing = typing + key;
- }
- } //close void keyPressed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement