AndEngine:RatioResolutionPolicy 纵向问题
我花了很多时间试图解决这个问题,但我仍然不明白为什么会发生这种情况。我看过很多使用 RatioResolutionPolicy 的示例,并且在我的代码中没有发现任何错误,区别只是所有示例都以横向运行,而不是纵向运行。这是我的代码:
this.mCamera = new Camera(0, 0, 320, 480);
final EngineOptions engineOptions = new EngineOptions(true,
ScreenOrientation.PORTRAIT, new RatioResolutionPolicy(320, 480), mCamera);
return new Engine(engineOptions);
这是 854x480 屏幕上的结果:
有人有任何想法吗?谢谢。
I've spent many hours trying to solve this problem, but I still can't understand why does this happen. I've seen a lot of examples of using RatioResolutionPolicy and found no mistakes in my code, difference is just that all examples are run in landscape orientation, not portrait. Here's my code:
this.mCamera = new Camera(0, 0, 320, 480);
final EngineOptions engineOptions = new EngineOptions(true,
ScreenOrientation.PORTRAIT, new RatioResolutionPolicy(320, 480), mCamera);
return new Engine(engineOptions);
And here's the result on a 854x480 screen:
Does anyone have any ideas? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有发布您的实际问题是什么,但我认为您正在谈论顶部/底部的黑色“条”?
原因是:
320 / 480 = 0.6666
480 / 854 = 0.5621
-->您将获得 134 个黑色像素,其中 67 个位于顶部,67 个位于底部。
You didn't post what your actual problem is, but I assume you are talking about the black 'bars' at the top/bottom?
The reason is:
320 / 480 = 0.6666
480 / 854 = 0.5621
--> You get 134 black pixels, 67 at the top and 67 at the bottom.