蓝色的黑色屏幕运行时的堆栈AndEngine程序
问题描述:
以下是程序的完整代码。当我在BlueStacks中运行程序时,出现了黑屏。我的视频卡驱动程序工作正常并已更新。请帮我找到问题。蓝色的黑色屏幕运行时的堆栈AndEngine程序
public class StartActivity extends BaseGameActivity {
private static final int CAMERA_WIDTH = 800;
private static final int CAMERA_HEIGHT = 480;
private Camera mCamera;
private Texture mTexture;
private TextureRegion mSplashTextureRegion;
@Override
public Engine onLoadEngine() {
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera));
}
@Override
public void onLoadResources() {
this.mTexture = new Texture(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.mSplashTextureRegion = TextureRegionFactory.createFromAsset(this.mTexture, this, "gfx/Splashscreen.png", 0, 0);
this.mEngine.getTextureManager().loadTexture(this.mTexture);
}
@Override
public Scene onLoadScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());
final Scene scene = new Scene(1);
/* Center the splash on the camera. */
final int centerX = (CAMERA_WIDTH - this.mSplashTextureRegion.getWidth())/2;
final int centerY = (CAMERA_HEIGHT - this.mSplashTextureRegion.getHeight())/2;
/* Create the sprite and add it to the scene. */
final Sprite splash = new Sprite(centerX, centerY, this.mSplashTextureRegion);
scene.getLastChild().attachChild(splash);
return scene;
}
@Override
public void onLoadComplete() {
}
}
答
图片的分辨率是多少?如果是高于512 * 512那么你需要改变这一行:
this.mTexture = new Texture(1024, 10244, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
我希望有人能帮我解决这个问题 – 007 2014-12-07 10:08:38
Logcat中有任何错误? – ranifisch 2014-12-07 11:20:18
Logcat中没有错误。我不知道为什么会出现这个问题 – 007 2014-12-07 13:31:10