Skip to content Skip to sidebar Skip to footer

Loading Texture In Libgdx Android Using File In Res?

In LibGdx, texture image is stored in asset folder and loaded using following code. Texture texture = new Texture(Gdx.files.internal('image/someImage.jpg')); I have different text

Solution 1:

You should look into libgdx's ResolutionFileResolver, and also use AssetManager (it will ease everything for you).

You supply it resolutions and the proper folder to use, and then libgdx automagically selects the folder with the best match.

Resolution[] resolutions = { newResolution(320, 480, ".320480"),
                          newResolution(480, 800, ".480800"),
                          newResolution(480, 856, ".480854") };
ResolutionFileResolverresolver=newResolutionFileResolver(newInternalFileHandleResolver(), resolutions);
manager = newAssetManager();

This is the way to do it in libgdx, you shouldn't touch the res folder.

Post a Comment for "Loading Texture In Libgdx Android Using File In Res?"