meow meow Asked:2020-05-20 20:41:16 +0000 UTC2020-05-20 20:41:16 +0000 UTC 2020-05-20 20:41:16 +0000 UTC 如何为非标准手机屏幕比例拉伸游戏? 772 我们需要一个在非标准屏幕上拉伸而不损失质量的公式。这样它将游戏的顶部从 16:9 标准延伸到 21:9(索尼手机) 不使用视口 java 1 个回答 Voted Best Answer meow meow 2020-05-20T20:41:16Z2020-05-20T20:41:16Z realWidth- 手机的真实高度 Width用于按 x 缩放元素 HEIGHT由 y public static float WIDTH; public static float HEIGHT; public static float realHeight; { WIDTH = 720f; HEIGHT = 1280f; } public GameField(Main main) { this.main = main; realHeight = Gdx.app.getGraphics().getHeight() / (Gdx.app.getGraphics().getWidth() / WIDTH); camera = new OrthographicCamera(WIDTH, realHeight); stage = new Stage(new StretchViewport(WIDTH, realHeight, camera));}
realWidth- 手机的真实高度Width用于按 x 缩放元素HEIGHT由 y