2012-07-27 27 views
1

我想提请使用一种方法,在PlayN展示应用一些TXT: 如何呈现文本字符串PlayN HTML/DOM

 
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 /月而不是HTML /大教堂。

回答

0

尝试使用tripleplay(https://github.com/threerings/tripleplay)。也许它会有所帮助。

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);