嗨我有一些来自libgdx的纹理atlas packer assetmanager的问题....也许有人有同样的问题...... 我在我的桌面应用程序中打包我的纹理...正在运行并生成包文件...
public class DesktopLauncher {
private static boolean rebuildAtlas = false;
private static boolean drawDebugOutline = true;
public static void main (String[] arg) {
if (rebuildAtlas) {
Settings settings = new Settings();
settings.maxWidth = 1024;
settings.maxHeight = 1024;
settings.duplicatePadding = false;
settings.debug = drawDebugOutline;
TexturePacker.process(settings, "asset_raw/images", "../android/assets/images", "ppack.pack");
}
在我的assetloader类中我加载了这个或者我也尝试了......
public void init (AssetManager assetManager) {
this.assetManager = assetManager;
// set asset manager error handler
assetManager.setErrorListener(this);
assetManager.load("../android/assets/images/ppack.pack",TextureAtlas.class);
// start loading assets and wait until finished
assetManager.finishLoading();
Gdx.app.debug(TAG, "# of assets loaded: "+ assetManager.getAssetNames().size);
for (String a : assetManager.getAssetNames())
Gdx.app.debug(TAG, "asset: " + a);
TextureAtlas atlas = assetManager.get(../android/assets/images/ppack.pack");
...
然而我收到错误:
com.mygdx.game.Assets: Couldn't load asset '../android/assets/images/ppack.pack'
但该文件存在并且其名称中没有奇怪的上部下部或其他奇怪的符号
有什么建议吗?
答案 0 :(得分:0)
你不应该
" ../机器人/资产/"
删除此部分。如果再次收到错误,请检查 运行/调试配置 (Android Studio)下的工作目录,并指定您的资源文件夹。
答案 1 :(得分:0)
通过将工作目录设置为... / gdx / first来解决它; 并加载ppack.atlas而不是.pack