我试图从sdcard加载TiledMap。
在TmxMapLoader.java中说...

 * Loads the {@link TiledMap} from the given file. The file is resolved via the {@link FileHandleResolver} set in the
 * constructor of this class. By default it will resolve to an internal file.


那么,如何将默认值更改为external?

谢谢

最佳答案

您可以在构造函数中提供自定义FileHandleResolver:

TiledMap map = new TmxMapLoader(new ExternalFileHandleResolver()).load("level1.tmx");


有关FileHandleResolver的更多信息:http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/loaders/FileHandleResolver.html

08-04 08:39