Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am using Andengine and when I start the examples there are black borders on left and right of the screen. Like this:

10000001
10000001
10000001

where 1 is black and 0 is not black. On my phone (Google Nexus 4) it is always. In emulator sometimes. it is in all examples from here: https://github.com/nicolasgramlich/AndEngineExamples

What is causing this?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Most likely this is because of the ResolutionPolicy you defined. For example if you choose the RatioResolutionPolicy AndEngine will try to keep the same width/height ratio, even if the real device resolutions vary. If you have a screen that is wider than the ratio allows, it will show the mentioned black bars.

You can find all the resolution policies in the GitHub Folder

Consider using CroppedResolutionPolicy that stretches the image beyond the borders and instead of black bars, you will get a bit of your screen cropped. The linked class will also give you two methods to find out how much was cropped.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.