1

I looked at many examples of andEngine Gles2.0 All of them take these :

private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;

Why is this value fixed? Why can't I do this:

int currentapiVersion = android.os.Build.VERSION.SDK_INT;
int honeyComb = android.os.Build.VERSION_CODES.HONEYCOMB_MR2;

Display display = getWindowManager().getDefaultDisplay();
if (currentapiVersion >= honeyComb) {
    Point size = new Point();
    display.getSize(size);
    CAMERA_WIDTH = size.x;
    CAMERA_HEIGHT = size.y;
} else {
    CAMERA_WIDTH = display.getWidth();
    CAMERA_HEIGHT = display.getHeight();
}
4

1 回答 1

2

如果你愿意,你可以这样做。我认为关键是定义一个固定大小,如 480x800,并将您的游戏/应用程序写入该大小,以确保一切看起来都在该分辨率下。然后使用 RatioResolutionPolicy 并让 AndEngine 处理缩放以适应其他屏幕尺寸。有关此问题的更多想法,请参阅我对这个问题的回答

不同屏幕尺寸Andengine Android上的精灵尺寸

于 2012-12-27T14:44:35.517 回答