0
votes

I'm currently working on a multiplayer 2d project, and have run into a problem. I'm following Brent Aureli's tutorial on creation a Super Mario like game. My problem occures when I want to draw text in the game world. Brent uses a downscale for the game world (1/100), to get a smooth gravity behaviour, the natural result is that a normal text is way too large for this downscaled world, and if I try to downscale the font with font.getData().setScale(1/100) the font simply dissapears (I believe it gets too small ot be rendered).

I have also tried using the free-type font generator, but ran into the same issues, aswell as using Heiro to generate a font with size 3.

Have anyone ran into the same problem and found a solution?

1
Typically, text and UI are done with a different Camera/Viewport than the gameplay, so the game world scale would be irrelevant. - Tenfour04

1 Answers

0
votes

I figured out a solution, which is to create a label, put it into a group and scale the group.

//Init
LabelStyle labelStyle = new LabelStyle(new BitmapFont(), Color.BLACK);
label = new Label("text", labelStyle);
label.setFillParent(true);
group = new Group();
group.addActor(label);
group.setScale(1f/100, 1f/100);

//In render
group.setPosition(x, y));
group.draw(batch, alpha);