无法在AndEngine Anchor Center中显示SVG

时间:2013-12-27 18:17:29

标签: svg andengine

我在将SVG纹理加载到项目时出现问题。这就是我正在做的加载它。

public void onCreateResources(
        OnCreateResourcesCallback pOnCreateResourcesCallback)
        throws IOException {
    // TODO Auto-generated method stub
    BuildableBitmapTextureAtlas mBuildableBitmapTextureAtlas = new BuildableBitmapTextureAtlas(
            this.getTextureManager(), 1024, 1024,
            TextureOptions.BILINEAR_PREMULTIPLYALPHA);

    this.mTextureRegion = SVGBitmapTextureAtlasTextureRegionFactory
            .createFromAsset(mBuildableBitmapTextureAtlas, this,
                    "gfx/somethig.svg", 1024, 1024);

    try {
        mBuildableBitmapTextureAtlas
                .build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(
                        0, 0, 0));

    } catch (TextureAtlasBuilderException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    pOnCreateResourcesCallback.onCreateResourcesFinished();
}

public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback)
        throws IOException {
    // TODO Auto-generated method stub
    Scene mScene = new Scene();
    Sprite suchSprite = new Sprite(1030, 550, this.mTextureRegion, this
            .getEngine().getVertexBufferObjectManager());
    mScene.attachChild(suchSprite);
    mScene.setBackground(new Background(0, 1, 1));
    pOnCreateSceneCallback.onCreateSceneFinished(mScene);
}

我得到的只是空白的黑色矩形......

有谁知道出了什么问题?

为你的冬天做点什么。

1 个答案:

答案 0 :(得分:0)

我实际上忘了加载textureAtlas:)...

我只是在建筑纹理下添加这一行:

mBuildableBitmapTextureAtlas.load();