私は2つの画面を持っています:720 x 405の解像度でFitViewportを使用し、480 x 270の解像度でFillViewportを使用するゲーム画面を使用するレベル選択画面ピクセル/メートル(/ 100)。libgdxビューポートでビューポートが変更される
特定のレベルを完了した後、レベル選択画面に戻りたいと思います。しかし、復帰時に完全にズームインしているように見える
Here is how it should look, and how it looks when first launched
ここHere is how it looks after coming out of the game
レベルの画面コードされています。
public LevelScreen(CrossplatformApp game) {
this.game = game;
this.camera = new OrthographicCamera();
this.levelstage = new Stage(new FitViewport(Constants.WIDTH, Constants.HEIGHT, camera));
this.background = new Texture("Screens/LevelScreen/LevelSelection.png");
this.backbutton = new Texture("Screens/BackButton.png");
this.level1texture = new Texture("Screens/LevelScreen/Button1.png");
this.level2texture = new Texture("Screens/LevelScreen/Button2.png");
this.level3texture = new Texture("Screens/LevelScreen/Button3.png");
}
@Override
public void resize(int width, int height) {
levelstage.getViewport().update(width, height, true);
}
そして、ゲーム画面:
this.game = gameFile;
this.camera = new OrthographicCamera();
this.viewport = new FillViewport(Constants.V_WIDTH/Constants.PPM, Constants.V_HEIGHT/Constants.PPM, camera);
this.levelHUD = new HUD(gameFile.batch, WorldPicker.getWorldName(playerMemory.player.worldAndLevelData.getCurrentWorld(), playerMemory.player.worldAndLevelData.getCurrentLevel()));
これらの2つの画面で共通することは何ですか? – Aryan
共通点はどういう意味ですか? –
ステージ、カメラ、ビューポートなど何かを共有していますか? – Aryan