问题
Is there anyway of doing it?
I can't find any tutorial related to it on google.
回答1:
Libgdx doesn't enforce any particular hierarchy or folder naming conventions for keeping your assets such that Gdx.files.internal("myassets/libgdx.png")
would work just fine on Desktop. However, Android projects do have a specific folder in its root named assets. The folder has to be strictly named "assets" as enforced by the Android project [1]. Therefore, it would be a better idea to lay your folder hierarchy the same way in other projects as well so that you won't have to make changes for individual platforms. A much better approach would be to just place your resources in the Android project and link them to other projects. This would allow you to update your resources in only one project and that would be reflected everywhere. This has been explained in detail here.
And as an informative note, start using AssetManager to manage assets for your Libgdx project as it would streamline asset handling to a great degree.
回答2:
You really do not need to do anything. You can use any folder in the Desktop project root. For example:
texture = new Texture(Gdx.files.internal("myfolder/libgdx.png"));
来源:https://stackoverflow.com/questions/20721143/how-to-set-assets-folder-of-libgdx-without-creating-an-android-project