首页 文章

如何停止和恢复我实现的ApplicationListener类?

提问于
浏览
0

我有类WallpaperAndDream实现ApplicationListener . 全部由ligdx实现(动态壁纸和白日梦) . 以下是创建和呈现的方法:

public void create() {
    camera = new OrthographicCamera(width, height);
    camera.position.set(width / 2, height / 2, 0);
    bg.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    batch = new SpriteBatch();
    Gdx.graphics.setContinuousRendering(false);
}


public void render() {
    GL10 gl = Gdx.graphics.getGL10();

    gl.glClearColor(bg_red, bg_green, bg_blue, 1f);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    camera = new OrthographicCamera(width, height);
    camera.position.set(width / 2, height / 2, 0);
    camera.update();
    camera.apply(Gdx.gl10);
    batch.setProjectionMatrix(camera.combined);

    batch.begin();
    BitmapFont font;
    font = new BitmapFont();
    font.setScale(3.0f);
    font.setColor(Color.RED);

    font.draw(batch, BouncerDaydream.maxLight+" "+BouncerDaydream.thisLight, 100, 100);

    batch.end();
    try {
        Thread.sleep(update_interval);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    Gdx.graphics.requestRendering();
}

当我在动态壁纸后做白日梦时它会交替画出所有,但我需要在这段时间暂停(或停止)白日梦并在可见时恢复它,我该怎么做? Thx提前!

1 回答

相关问题