AndEngine does scale your Sprites
even in your example. The reason why the result is not what you expected is that you set the camera's width
and height
manually (based on the resolution).
If you really want every sprite scaled in the same way on every display, then you should choose one fixed resolution in which you create your game.
For example you could set up every sprite and every position to a resolution of 960x640.
// skip the whole if(resolutionRatio == 1.66){.. part
this.mCamera = new SmoothCamera(0, 0, 960f, 640f, 100, 100, 1.0f);
AndEngine will then scale the camera, so that it fills as much of the display as possible.
public EngineOptions onCreateEngineOptions() {
EngineOptions options = new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(1.5f), camera;
return options;
}
the 1.5f
is the fitting aspect ratio for the 960x640 resolution.
Now you won't have to take care of the different display sizes anymore.