4
我想旋转libgdx中的BitmapFont。有关于这个问题的话题。 Draw a BitmapFont rotated in libgdx但是,我尝试的第一个解决方案会削减我的文本,整个文本不会出现(对角线切割)。它也会将它旋转90度,当它说它应该是180度。我只是不明白。文字旋转libgdx
代码:
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();
}
请显示一些代码,尤其是您设置和初始化矩阵的部分。 –
U可以使用补间,但为此你必须让你自己的文本精灵访问器 –
你能举个例子吗? – user2685747