Search code examples
androidresolutionportraitandengine

AndEngine: RatioResolutionPolicy portrait orientation issue


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:enter image description here

Does anyone have any ideas? Thanks.


Solution

  • 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.