Mohammad Areeb Siddiqui
Mohammad Areeb Siddiqui

Reputation: 10179

How to set assets folder of libgdx without creating an android project?

Is there anyway of doing it?

I can't find any tutorial related to it on google.

Upvotes: 8

Views: 8161

Answers (2)

Rafay
Rafay

Reputation: 6188

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.

Upvotes: 7

Daahrien
Daahrien

Reputation: 10320

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"));

Upvotes: 7

Related Questions