我正在尝试将一些SVG加载到我的游戏中,但我正在使用truoble。我试过从论坛上阅读Android烹饪书,文档和答案,但我找不到解决方案。我现在处于一个可以实际加载图像和游戏构建的状态,但现在我无法显示它们。见如下:
在.svg图片中加载:
BuildableBitmapTextureAtlas bitmapTextureAtlas = new BuildableBitmapTextureAtlas(
engine.getTextureManager(), 1024, 1024, TextureOptions.BILINEAR); //setting up texture atlas
try {
this.mBuildableBitmapTextureAtlas
.build(new BlackPawnTextureAtlasBuilder<IBitmapTextureAtlasSource, BitmapTextureAtlas>(
0, 0, 1));
} catch (final TextureAtlasBuilderException e) {
Debug.e(e);
}
SVGBitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/game/");
mLowResTextureRegion = SVGBitmapTextureAtlasTextureRegionFactory
.createFromAsset(bitmapTextureAtlas, activity,
"spinningarrow.svg", 32, 32);
mMedResTextureRegion = SVGBitmapTextureAtlasTextureRegionFactory
.createFromAsset(bitmapTextureAtlas, activity, "spinningarrow.svg",
128, 128);
// Create a high-res (256x256) texture region of svg_image.svg
mHiResTextureRegion = SVGBitmapTextureAtlasTextureRegionFactory
.createFromAsset(bitmapTextureAtlas, activity, "spinningarrow.svg",
256, 256);
bitmapTextureAtlas.load();
实际上将它附加到场景中:
float currentSpritePosition = (WIDTH / ((SPRITE_SIZE) * SPRITE_COUNT)) + SPRITE_SIZE * 0.5f;
Sprite lowResSprite = new Sprite(currentSpritePosition, HEIGHT / 2, SPRITE_SIZE, SPRITE_SIZE, rM.mLowResTextureRegion, rM.engine.getVertexBufferObjectManager());
attachChild(lowResSprite);
currentSpritePosition += SPRITE_SIZE;
// Create & attach the med-res sprite to the scene (mid)
Sprite medResSprite = new Sprite(currentSpritePosition, HEIGHT / 2, SPRITE_SIZE, SPRITE_SIZE, rM.mMedResTextureRegion, rM.engine.getVertexBufferObjectManager());
attachChild(medResSprite);
currentSpritePosition += SPRITE_SIZE;
// Create & attach the high-res sprite to the scene (right side)
Sprite hiResSprite = new Sprite(currentSpritePosition, HEIGHT / 2, SPRITE_SIZE, SPRITE_SIZE, rM.mHiResTextureRegion, rM.engine.getVertexBufferObjectManager());
attachChild(hiResSprite);
这构建,但我看不到图像;即使我硬编码它的坐标。
有问题的svg位于http://www.sendspace.com/file/nnjsfe