Hey everyone,
could anyone give me some tips how to make the text scroll.
At the moment when the text exceeds the bottom of the window it becomes invisible, cos it goes down to an imaginary space below.
I am trying to think of how to delete the first line and shift the whole text up, so there is a new empty line for more text. Basically making text scroll while typing.
Thanks in advance.
- import fullscreen.*;
- FullScreen fs;
- PFont f1;
- String txt="";
- int fntSz=100;
- int fntNum=1;
- void setup() {
- size(screen.width, screen.height); // set size
- smooth();
- background(255);
- fs = new FullScreen(this); // Create the fullscreen object
- fs.enter(); // enter fullscreen mode
- f1 = loadFont("SOUND_08_07-48.vlw");
- }
- void draw() {
- noCursor();
- background(255);
- textFont(f1, fntSz);
- //textFont(f2, 36);
- fill(0);
- stroke(0);
- textAlign(LEFT);
- text(txt, width/20, height/20, width-width/10, height);
- }
- void keyPressed() {
- if (keyCode == BACKSPACE) {
- if (txt.length() > 0) {
- txt = txt.substring(0, txt.length()-1);
- }
- }
- else if (keyCode == DELETE) {
- txt = "";
- }
- else if (keyCode != SHIFT) {
- txt = txt + key;
- }
- }
1