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 に答える