I want to rotate BitmapFont in libgdx. There are topics on this matter. Draw a BitmapFont rotated in libgdx However, the first solution I try cuts my text, the whole text doesn't appear (diagonal cut). And it also rotates it ba 90 degrees, when it says it should be 180. I just don't get it.
Code:
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();
}