0
\$\begingroup\$

My ingame camera has units that 25 times less than screen units so when I render BitmapFont generated for camera which used in non-game screens (settings, level choose etc.) it's even doesn't fit in camera.

I came up with some solutions:

  1. Generate font with right size, but No cap character found in font exception caught.
  2. Scale font with font.getData().setScale(float scaleXY) but got this:enter image description here
  3. Increase camera units but I'll need to rewrite a lot of code depending on camera combined matrix.

Is there any easier way to do this?

\$\endgroup\$
1
\$\begingroup\$

You could create a second 'overlay' camera that is sized differently than the main camera and draw text using that camera.

batch.setProjectionMatrix(sceneCamera.combined);
batch.begin();
drawSceneThings(batch);
batch.end();

batch.setProjectionMatrix(uiCamera.combined);
batch.begin();
drawUIThings(batch);
batch.end();

Otherwise, using distance field fonts might give you better results than bitmap fonts since they scale much better, although this will require some work to get the shaders set up and rendering properly.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.