1

我正在尝试使用 PlayN Showcase 应用程序中的方法绘制一些 txt:

protected static Layer createTextLayer(TextLayout layout, int color) {
    CanvasImage image = graphics().createImage((int) Math.ceil(layout.width()), (int) Math.ceil(layout.height()));
    image.canvas().setFillColor(color);
    image.canvas().fillText(layout, 0, 0);
    return graphics().createImageLayer(image);
}

它适用于 HTML/Canvas,但不适用于 HTML/Dom。

4

1 回答 1

0

Try to use tripleplay (https://github.com/threerings/tripleplay). Maybe it will help.

Label label = new Label("MY LABEL");
Interface iface = new Interface();
Stylesheet rootSheet = Stylesheet.builder().create();
Root nameroot = iface.createRoot(AxisLayout.horizontal().gap(300), rootSheet);
nameroot.add(label);
nameroot.setSize(100, 30);
nameroot.setStyles(Styles.make(Style.HALIGN.left));
PlayN.graphics().rootLayer().add(nameroot.layer);
于 2012-08-23T05:21:53.503 回答