它通常在drawable
文件夹中,但当我把它们放在那里时,我得到了一个FileNotFoundException
。不应该AssetBasePath
像"drawable/"
然后纹理区域"ire.png"
,对吗?如果我忘记提及其他任何事情,请介意我。
在项目模块中,在src
- > res
文件夹中找到drawable。
如果你没有得到drawable文件夹创建一个并保留你的资源。
@Override
protected void onCreateResources() {
BitmapTextureAtlas mBitmapTextureAtlas = new BitmapTextureAtlas(getTextureManager(), 71, 71, TextureOptions.DEFAULT);
mBitmapTextureAtlas.load();
TextureRegion mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(mBitmapTextureAtlas, this, "ic_launcher.png", 0, 0);
}
ic_launcher.png
在drawable文件夹中。
您还可以将资源放在assets文件夹中并以这种方式获取:
@Override
protected void onCreateResources() {
ITexture backgroundTexture=new BitmapTexture(getTextureManager(), new IInputStreamOpener() {
@Override
public InputStream open() throws IOException {
return getAssets().open("gfx/background.png");
}
});
}
background.png
位于gfx
文件夹中,存在于assets
文件夹中。