Andengine半黑屏
Andengine Half black screen
我正在尝试使用 andengine 开发游戏。我创建了一个摄像头,设置了它的边界和尺寸 (720X1280) 但是当我 运行 应用程序时,我只看到屏幕的顶部,其余部分是黑色的。
@Override
public EngineOptions onCreateEngineOptions() {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
float ratio = (float) size.y / (float) size.x;
GameSettings.CAMERA_HEIGHT = (int) (GameSettings.CAMERA_WIDTH / ratio);
Constants.camera = new SmoothCamera(0, 0, GameSettings.CAMERA_WIDTH, GameSettings.CAMERA_HEIGHT, 500, 500, 0.1f);
Constants.camera.setBoundsEnabled(true);
EngineOptions en_op = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(GameSettings.CAMERA_WIDTH, GameSettings.CAMERA_HEIGHT), Constants.camera);
en_op.getAudioOptions().setNeedsSound(true);
en_op.getRenderOptions().setDithering(true);
return en_op;
}
@Override
public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws Exception {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("graph/");
MyResources.SplashTextureRegion = MyResources.getTextureRegion(this, "splash.jpg", 720, 1280);
pOnCreateResourcesCallback.onCreateResourcesFinished();
}
我做错了什么?
好的,我发现...这是比率计算。我需要多个宽度,而不是
我正在尝试使用 andengine 开发游戏。我创建了一个摄像头,设置了它的边界和尺寸 (720X1280) 但是当我 运行 应用程序时,我只看到屏幕的顶部,其余部分是黑色的。
@Override
public EngineOptions onCreateEngineOptions() {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
float ratio = (float) size.y / (float) size.x;
GameSettings.CAMERA_HEIGHT = (int) (GameSettings.CAMERA_WIDTH / ratio);
Constants.camera = new SmoothCamera(0, 0, GameSettings.CAMERA_WIDTH, GameSettings.CAMERA_HEIGHT, 500, 500, 0.1f);
Constants.camera.setBoundsEnabled(true);
EngineOptions en_op = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(GameSettings.CAMERA_WIDTH, GameSettings.CAMERA_HEIGHT), Constants.camera);
en_op.getAudioOptions().setNeedsSound(true);
en_op.getRenderOptions().setDithering(true);
return en_op;
}
@Override
public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws Exception {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("graph/");
MyResources.SplashTextureRegion = MyResources.getTextureRegion(this, "splash.jpg", 720, 1280);
pOnCreateResourcesCallback.onCreateResourcesFinished();
}
我做错了什么?
好的,我发现...这是比率计算。我需要多个宽度,而不是