BitmapFont-新的1.6 libGDX中的getBounds方法在哪里


Answers:


13

有一篇文章解释了这些更改,但是不容易找到。该链接位于1.5.6版本更改日志中:http : //www.badlogicgames.com/wordpress/? p=3666

有关字体更改的链接为:http : //www.badlogicgames.com/wordpress/? p= 3658

private static GlyphLayout glyphLayout = new GlyphLayout();
private BitmapFont fontA = new BitmapFont(), fontB = new BitmapFont();

// Set text and font each time you want to calculate bounds.
glyphLayout.setText(fontA, "my string");
fontA.draw(batch, glyphLayout, x + glyphLayout.width / 3, y + glyphLayout.height / 3);
y += glyphLayout.height;

glyphLayout.setText(fontB, "different font");
fontB.draw(batch, glyphLayout, x + glyphLayout.width / 3, y + glyphLayout.height / 3);
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.