我对 libGDX 有疑问...
我想调整我的图片大小,但我不知道找到这个比例...你能帮帮我吗?
我的代码:
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void show() {
// TODO Auto-generated method stub
float x = 0;
this.w = Gdx.graphics.getWidth();
this.h = Gdx.graphics.getHeight();
System.out.println(w);
System.out.println(h);
camera = new OrthographicCamera(1, 1);
batch = new SpriteBatch();
imgAbalone = new Texture(Gdx.files.internal("data/AbaloneCS5.gif"));
imgFond = new Texture(Gdx.files.internal("data/parquet.jpg"));
imgAbalone.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegion region = new TextureRegion(imgAbalone, 0, 0, 700, 700);
spriteAbalone = new Sprite(region);
spriteAbalone.setSize(0.9f , 0.9f);
spriteAbalone.setOrigin(spriteAbalone.getWidth()/2, spriteAbalone.getHeight()/2);
spriteAbalone.setPosition(-spriteAbalone.getWidth()/2, -spriteAbalone.getHeight()/2);
TextureRegion regionFond = new TextureRegion(imgFond, 0, 0, 1000,1000);
spriteFond = new Sprite(regionFond);
spriteFond.setSize(1, 1);
spriteFond.setOrigin(0,0);
spriteFond.setPosition(-spriteFond.getWidth()/2, -spriteFond.getHeight()/2);
}
我不知道在 resize () 里放什么