BitmapFontAlignmentTest.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:libgdxcn 作者:
private void renderMultiLine () {
    String text = "Multi\nLine";
    float x = logoSprite.getX();
    float y = logoSprite.getY();
    float width = logoSprite.getWidth();
    float height = logoSprite.getHeight();

    TextBounds bounds = font.getMultiLineBounds(text);
    x += width / 2 - bounds.width / 2;
    y += height / 2 + bounds.height / 2;

    font.drawMultiLine(spriteBatch, text, x, y);

    // Note that multi line text can be aligned:
    // font.drawMultiLine(spriteBatch, text, x, y, width, HAlignment.CENTER);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号