我的游戏手机侧面有2个黑条。我试图使它适合FitViewport并且它应该适合屏幕,因为游戏是平台游戏并且横向滚动所以应该总是适合屏幕的宽度,所以我不知道为什么有2个黑条。我只是想要一些帮助来解决这个问题,并让它在所有常规屏幕尺寸上填满整个屏幕。谢谢亚历克斯。
public static final float V_WIDTH = 2234;
public static final float V_HEIGHT = 1400;
public PlayScreen(MarioBros game) {
this.game = game;
gameCam = new OrthographicCamera();
gamePort = new FitViewport(MarioBros.V_WIDTH / MarioBros.PPM , MarioBros.V_HEIGHT / MarioBros.PPM , gameCam);
答案 0 :(得分:0)
Alex,请使用StretchViewport:
public PlayScreen(MarioBros game) {
this.game = game;
gameCam = new OrthographicCamera();
gamePort = new StretchViewport(MarioBros.V_WIDTH / MarioBros.PPM , MarioBros.V_HEIGHT / MarioBros.PPM , gameCam);