0

以下是该程序的完整代码。当我在 BlueStacks 中运行程序时,出现了黑屏。我的显卡驱动程序工作正常并已更新。请帮我找出问题所在。

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() {
}
}
4

1 回答 1

0

图片的分辨率是多少?如果高于 512*512 那么你需要改变这一行:

this.mTexture = new Texture(1024, 10244, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
于 2014-12-12T14:37:53.957 回答