我的LibGDX游戏有一个带有标志和一些按钮的启动屏幕。我无法弄清楚如何按比例缩放标志以避免扭曲。
以下是代码:
public StartScreen(int lastScore, InputListener inputListener) {
super();
this.listener = inputListener;
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Table table = new Table();
table.setFillParent(true);
table.setBackground(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("background.png")))));
Image imageLogo = new Image();
imageLogo.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("title.png")))));
// Here's the problem, the image is not scaled correctly...
table.add(imageLogo).center().colspan(2);
table.row();
// Some Buttons
table.add(button1).colspan(2).padBottom(30);
table.row();
table.add(button2).padBottom(30);
table.add(button3).padBottom(30);
table.row();
table.add(button4).colspan(2);
stage.addActor(table);
//table.debug();
}