何时使用 gdx.files.internal 以及何时使用相对路径?
when to use gdx.files.internal and when relative path?
我见过很多这两种情况的例子,例如:
atlas = new TextureAtlas("skins/userInterface.pack");
white = new BitmapFont(Gdx.files.internal("font/white.fnt"));
我在教程中看到过,但它也可以这样工作:
atlas = new TextureAtlas(Gdx.files.internal("skins/userInterface.pack"));
white = new BitmapFont("font/white.fnt");
什么时候应该使用 Gdx.files.internal 或直接使用资产文件夹的相对路径?
一模一样。当使用 String
参数时,构造函数使用 Gdx.files.internal
来解析文件,就像您自己做的那样。
你可以看到这个 here 例如 TextureAtlas
.
我见过很多这两种情况的例子,例如:
atlas = new TextureAtlas("skins/userInterface.pack");
white = new BitmapFont(Gdx.files.internal("font/white.fnt"));
我在教程中看到过,但它也可以这样工作:
atlas = new TextureAtlas(Gdx.files.internal("skins/userInterface.pack"));
white = new BitmapFont("font/white.fnt");
什么时候应该使用 Gdx.files.internal 或直接使用资产文件夹的相对路径?
一模一样。当使用 String
参数时,构造函数使用 Gdx.files.internal
来解析文件,就像您自己做的那样。
你可以看到这个 here 例如 TextureAtlas
.