问题
I tried to load an TiledMap from the sdcard. In TmxMapLoader.java is says...
* 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.
So, how can I change the default value to external?
Thank you
回答1:
You can provide custom FileHandleResolver in constructor:
TiledMap map = new TmxMapLoader(new ExternalFileHandleResolver()).load("level1.tmx");
More info about FileHandleResolver: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/loaders/FileHandleResolver.html
来源:https://stackoverflow.com/questions/25505014/libgdx-tmxmaploader-load-external-files