0
我想使用andengine將SVG呈現到屏幕,但不幸的是它沒有被顯示。另外,我在運行該項目時沒有遇到任何異常或錯誤,因此我發現調試非常困難。無法在angengine中顯示SVG
我看過this post,但我猜想BlackPawnTextureBuilder
在GLES2上不可用。
我在下面列舉了我的代碼部分,
public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws Exception
{
BuildableBitmapTextureAtlas buildableBitmapTextureAtlas = new BuildableBitmapTextureAtlas(this.getTextureManager(), 2048, 2048, TextureOptions.BILINEAR);
logoSplashITextureRegion = SVGBitmapTextureAtlasTextureRegionFactory.createFromAsset(buildableBitmapTextureAtlas, this, "gfx/BrickRed.svg", 80, 40);
buildableBitmapTextureAtlas.load();
pOnCreateResourcesCallback.onCreateResourcesFinished();
}
public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) throws Exception
{
logoSplashScene = new Scene();
logoSplashSprite = new Sprite(0, 0, logoSplashITextureRegion,mEngine.getVertexBufferObjectManager())
{
@Override
protected void preDraw(GLState pGLState, Camera pCamera)
{
super.preDraw(pGLState, pCamera);
pGLState.enableDither();
}
};
logoSplashSprite.setPosition((CAMERA_WIDTH - logoSplashSprite.getWidth()) * 0.5f, (CAMERA_HEIGHT - logoSplashSprite.getHeight()) * 0.5f);
logoSplashScene.attachChild(logoSplashSprite);
pOnCreateSceneCallback.onCreateSceneFinished(BrickActivity.logoSplashScene);
}
我忘記了在代碼中的東西嗎? 在此先感謝您的幫助。
哪個版本的Android,你運行這個嗎?只有3.0+版本才支持SVG。以前的版本不會渲染SVG,因此會變成空白。 – praneetloke
我沒有安卓手機。因此我一直在使用android模擬器。 示例項目SVGTextureRegionExample運行時沒有問題。但我注意到示例項目擴展了'SimpleBaseGameActivity',而我擴展了'BaseGameActivity'。 –