[英]libgdx stage doesn't draw stretched image
我正在使用libgdx'階段來繪制背景。 背景圖像應該伸展以適合所有尺寸的手機和平板電腦。 但圖像僅顯示為小圖像,不會拉伸。 有什么想法嗎?
@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);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.