开发者

Text not showing up in Processing

Here is my Processing program that I'm editing in Eclipse:

import processing.core.PApplet;

@SuppressWarnings("serial")
public class ProcessingDebugGUI extends PApplet {
    public void setup() {

        textFont(loadFont("Candara-48.vlw"));

        fill(0, 102, 153);
        text("Increasing", 10, 20, 70, 70);
        text("Decreasing", 10, 40);

        size(200, 200);
        background(200);
    }

    public void draw() {
        stroke(255);
        if (mousePress开发者_JAVA百科ed) {
            line(mouseX, mouseY, pmouseX, pmouseY);
        }
    }
}

The text doesn't show up, but aside from that it works fine. (The user can draw white pixels on the applet with the mouse.)

I'm trying to work from this example.

I created the "Candara-48.vlw" file from Processing's "Create Font" command, then placed it in eclipse workspace\projectName\bin\data.

What am I doing wrong?

Solution: Move the text() calls to draw().


Move the text() calls to draw().


Everything that you want to be shown in the screen must be put in the draw function, otherwise it will desapear from the screen on the first draw.

Try put delay(10000); in the beginning of the draw function and you'll see your text (until the delay ends and the first draw occurs).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜