Posts

Showing posts from March 15, 2019

How to draw text in world coordinate space?

Image
-1 I'm creating a game in libGDX. I want to create some UI elements (buttons and stuff), because of my app design, I would like to draw them in the world space, as other game objects. I'm using Freetype generator that generates a bitmap font from true type font files(.ttf). The problem is that the dimension of the font is in pixels. Orthographic camera that I use to to render the world, has viewport size of approximately 10x10, so when I generate a font at the size of 10, it covers almost whole screen(too big) and also looks very ugly because generated bitmap for the font is too small (too few pixels). What I want is to create sprite, draw it at same size(world space) and draw text over it, and basicly create a button. Is there some well established way how to deal with this?