我有类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提前!
答案 0 :(得分:0)
我不确定我理解你的问题,但是为了创建动态壁纸你应该扩展AndroidLiveWallpaperService,而对于Daydreams扩展AndroidDaydream。
此页面上有更多信息:https://github.com/libgdx/libgdx/wiki/Starter-classes-&-configuration