java,libgdx - 无法显示自定义字体

时间:2015-05-03 22:16:15

标签: java android libgdx

我有以下类,假设引用一个字体,然后在事件发生后将字符串绘制到屏幕上。这个类就是这样调用的。

if(grumpface.whiteballoon.getBoundingRectangle()。overlaps(spriterect)){

                ((Game) Gdx.app.getApplicationListener()).setScreen(new GameOverScreen());
        }
        ;

它引用它的类但我还是不能让字体出现任何暗示?

class GameOverScreen implements Screen{

    private Stage stage;

    // Called automatically once for init objects
    @Override
    public void show() { 
        stage = new Stage();

       stage.setDebugAll(true); // Set outlines for Stage elements for easy debug

        BitmapFont white = new BitmapFont(Gdx.files.internal("hazey.fnt"), false);
        LabelStyle headingStyle = new LabelStyle(white, Color.BLACK);
        Label gameoverstring = new Label("game ovaaaa!", headingStyle);
        gameoverstring.setPosition(100, 100);
        stage.addActor(gameoverstring);


    }

    // Called every frame so try to put no object creation in it
    @Override
    public void render(float delta) { 
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);


       stage.act(delta);

        stage.draw();



    }

1 个答案:

答案 0 :(得分:0)

标签的字体颜色设置为"黑色",与背景颜色相同。