We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I want to adapt my text in function of height with cp5.
import controlP5.*;
ControlP5 cp5;
Textarea myTextarea;
void setup() {
size(400, 800);
cp5 = new ControlP5(this);
myTextarea = cp5.addTextarea("txt")
.setPosition(0, 0)
.setSize(200, 700)
.setFont(createFont("arial", 800/40))
.setLineHeight(14);
myTextarea.setText("Step 1 : The victim must be lying on the back, head up. \n\n"
+" "
+"Step 2: Kneel down by the victim. Denude his/her chest. \n\n "
+" "
+"Step 3: Put your hands crossed on his/her chest. Take on your fingers for purpose of to you serves heel of your hands.. \n\n"
+""
+"Step 4: Start the massage by pressing your hands at the middle on the victime's chest, hand extended, elbows blocked. Get off your hands 4 to 5 centimetres then let them up for the blood back into the hearth. It's not recommended to practice mouse to mouse during massage cardiac. \n\n "
+""
+"Step 5: Following the massage until help arrived.\n\n""
);
}
I thought with a friend to take this code :
myTextarea = cp5.addTextarea("txt")
.setPosition(0, 0)
.setSize(200, 800)
.setFont(createFont("arial", 12))
.setLineHeight(14);
And to transform it like it :
myTextarea = cp5.addTextarea("txt")
.setPosition(0, 0)
.setSize(200,height/50)
.setFont(createFont("arial", 12))
.setLineHeight(14);
With a calculation for change the font height with the screen height, but we don't find the calculation.
If you find a other solution, say it !