1
我使用libgdx的舞臺來繪製背景。 背景圖片應該適合所有尺寸的手機和平板電腦。但圖像只顯示爲小圖像,不能伸展。任何想法爲什麼?libgdx stage不繪製拉伸圖像
@Override
public void show() {
stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
batch = new SpriteBatch();
Assets.load();
Image img = new Image(new TextureRegion(Assets.background));
stage.addActor(img);
Table table = new Table(skin);
stage.addActor(table);
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
stage.act(delta);
stage.draw();
}
@Override
public void resize(int width, int height) {
stage.setViewport(width, height, true);
}