Downloaded font: comic-sans-ms.ttf. added all necessary dependencies to the gradle. In the assets threw the font. Created method:
private void createFonts() { FileHandle fontFile = Gdx.files.internal("comic-sans-ms.ttf.ttf"); FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile); FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter(); parameter.size = 16; parameter.color.add(Color.BLACK); font = generator.generateFont(parameter); generator.dispose(); } //в конструкторе вызываю public GameScreen(final Drop gam) { createFonts(); }
In render render variable that increases its value:
font.getData(); font.getColor(); font.draw(game.batch, " " + game.dropsGatchered, 120, 470);
after launch, the numbers are not displayed on the screen (game.dropsGatchered). If you do not use fonts, then with standard libgdx fonts everything is drawn. Used this instruction