2014-12-07 59 views
0

以下是程序的完整代碼。當我在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() { 
} 
} 
+0

我希望有人能幫我解決這個問題 – 007 2014-12-07 10:08:38

+0

Logcat中有任何錯誤? – ranifisch 2014-12-07 11:20:18

+0

Logcat中沒有錯誤。我不知道爲什麼會出現這個問題 – 007 2014-12-07 13:31:10

回答

0

圖片的分辨率是多少?如果是高於512 * 512那麼你需要改變這一行:

this.mTexture = new Texture(1024, 10244, TextureOptions.BILINEAR_PREMULTIPLYALPHA);