We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi guys I`m new here. I have a problem when trying to display a text file. How do I manipulate the string into the rectangle box as I want to display some information from a text file. Any help will be very appreciated. Thanks in advance!!!
` PFont f; PImage img, img1, img2, img3, img4, img5; PImage left, right;
String my_text = "CYRBORG"; String[] words; String entireplay;
float x = width/2; float y = 100; int index = 0;
void setup() { size(1200, 800, P3D); background(11, 39, 13); f = createFont("Arial", 32, true); img = loadImage("cyborg.png"); left = loadImage("arrow-left.png"); right = loadImage("arrow-right.png"); String[] lines = loadStrings("cyrborg.txt"); entireplay = join(lines, " "); println(entireplay); words = split(entireplay, " ");
}
void draw() {
fill(93, 142, 97);
stroke(10, 18, 11);
rect(50, 50, 500, 700);
//translate and rotate the image around its cyrcle
//pushMatrix();
//translate(300, 200, 0);
//rotateY(radians(r));
img.resize(280,650);
image(img,160,100);
//r += 1;
//popMatrix();
image(left, 75, height/2 - 50 );
image(right, 480, height/2 - 50 );
line(width/2, 50, width/2, height-50);
line(width/2 + 50, 100, width- 50, 100);
fill(0);
noStroke();
textFont(f);
fill(255);
noStroke();
text(my_text,650,90);
fill(93, 142, 97);
stroke(10, 18, 11);
rect(width/2 + 50, 150, 500, 600);
for(int i = 0; i < words.length; i++)
{
fill(255,127);
textSize(28);
text(words[i], 700+i, 200, 400, 400);
} // end form loop
}// end draw `
Answers
Manipulate in what way? Change its color? Combined fields under the same text element? Something similar to: https://processing.org/reference/concat_.html
although there are other options:
Kf
you don't need a for loop
This
should do the job.
Alternatively
Alternatively with a for loop say
before setup say
in setup() change this
to
Remark
it's cyborg without the first "r"
How to post in the processing forum.
Best is to hit ctrl-t in processing first before copy paste into the forum
You can edit your post (click the small gear and the 'Edit').
How to format Code:
thanks a million!!!
thanks kfrajer for the help. Chrisir solve the problem for me. Just wanted to text file and display it inside a box
Great!