Loading texture in libgdx android using file in res?

In LibGdx, the texture image is saved in the resource folder and loaded using the following code.

Texture texture = new Texture(Gdx.files.internal("image/someImage.jpg"));

I have different textures for different screen resolutions, so I want to use the "res /" Android directory to save the texture image, which helps to load the corresponding image file for the corresponding resolution.

Is there any way to download the image file from the "res /" directory of Android?

+5
source share
2 answers

You should look at libgdx ResolutionFileResolver and also use AssetManager (this will make it easy for you).

, libgdx .

Resolution[] resolutions = { new Resolution(320, 480, ".320480"),
                          new Resolution(480, 800, ".480800"),
                          new Resolution(480, 856, ".480854") };
ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), resolutions);
manager = new AssetManager();

libgdx, res.

+9

All Articles