【发布时间】:2013-09-22 09:40:00
【问题描述】:
我想在 libgdx 中旋转 BitmapFont。有关于这个问题的话题。 Draw a BitmapFont rotated in libgdx 但是,我尝试的第一个解决方案剪切了我的文本,整个文本都没有出现(对角线剪切)。当它说应该是 180 度时,它还会将它旋转 90 度。我就是不明白。
代码:
public void show() {
sr = new ShapeRenderer();
w = Gdx.graphics.getWidth();
h = Gdx.graphics.getHeight();
textRotation = new Matrix4();
textRotation.setToRotation( new Vector3(200,200, 0), 180);
rectThickness = h / 120;
c1 = Color.WHITE;
c2 = Color.WHITE;
f = new BitmapFont(Gdx.files.internal("fonts/MyFont.fnt"),
Gdx.files.internal("data/MyFont.png"), true);
f.setScale(h/500);
sb = new SpriteBatch();
}
private void renderPlayerScores() { //callend in render
sb.setTransformMatrix(textRotation);
f.setColor(players[0].getColor());
sb.begin();
f.draw(sb, "Player 1: "+ Integer.toString(scores[0]), 100, 110);
sb.end();
}
【问题讨论】:
-
您可以使用补间,但为此您必须制作自己的文本精灵访问器
-
你能给我举个例子吗?
-
你找到解决办法了吗?
标签: java rotation libgdx bitmap-fonts