I am using a Viewport for my libGdx landscape game like this.
public static final int WORLD_WIDTH = 1280;
public static final int WORLD_HEIGHT = 800;
camera = new OrthographicCamera();
float aspectRatio = Constants.WORLD_WIDTH / Constants.WORLD_HEIGHT;
ViewPort viewPort = new FillViewport(WORLD_WIDTH * aspectRatio,WORLD_HEIGHT, camera);
I am using all positions in terms of this width and height.
It is working fine in all devices except device that have screen resolution greater than 1300.
In device that have greater resolution than 1300,only middle part of the game is visible.I tried using stretched viewport for the greater resolution device,but it is giving all game elements stretched.
How can I make my game working in all devices fine?Do I need to change the viewport?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…