Chopped Off Text
in
Programming Questions
•
1 year ago
Hello
In the following code I use a text file that has long lines. I want to wrap the text into many lines if it exceeds a specific part of the screen in the X axis. I have tried different ways but no luck.
Any help?
- int textY = 10;
- int textX = 50;
- int start = 0;
- int numLines;
- int yDist = 15;
- String[] lines;
- void setup() {
- size(1024, 768);
- lines = loadStrings("data.txt");
- numLines = height/yDist;
- }
- void draw() {
- background(250);
- rect(923, 0, width, height);
- start = abs(textY/yDist);
- for (int i = 0; i < numLines; i++ ) {
- fill(0);
- text(lines[i+start], 380, (yDist * i), 1000, 20);
- }
- }
1