text() in Processing
-
07-11-2019 - |
Pregunta
I'm playing around with Processing to see how everything works, but when dealing with the text() method, it seems to be having load time issues.
The code I have simple loads a PNG image onto the screen, followed by 3 4 letters words of size 24. When I leave only the image loading code in there, the application starts straight away, but when I put the text() code in, it takes approximately 3-4 seconds before it loads.
The above was done straight from Processing application, but I'm actually developing it inside a JFrame, so for the first 4 seconds, I actually see a blank JFrame which is quite ugly.
My question to you guys is whether any of you are aware of an issue with text(), or if there is a logical reason as to why it takes so long to load up.
--Running Java 7 on a Quad core machine
Here's the relevant code
PImage backgroundImage;
PFont font;
/**
* PApplet method - performs all setup actions
*/
public void setup(){
this.size( 1400, 900);
backgroundImage = loadImage( "EG_dark.png" );
backgroundImage.resize( width, height );
this.background(backgroundImage);
font = createFont("AmericanTypewriter", 24);
textFont(font);
}
/**
* PApplet method - All drawing occurs here
*/
public void draw(){
if(backgroundImage.width != width || backgroundImage.height != height){
backgroundImage.resize( width, height );
}
this.background(backgroundImage);
fill(0, 102, 153);
text("word", 15, 30);
fill(0, 102, 153);
text("word", 15, 60);
fill(0, 102, 153);
text("word", 15, 90);
}
No hay solución correcta