LibGDX loads all images from the catalog into the AssetManager in a loop, taking age

I have so far loaded all the textures into the AssetManager class using

manager.load("images/image_1.png", Texture.class);

this works fine, but I'm working on a project that uses a very large number of small images and would like to use a more general way to upload these files. I tried -

FileHandle[] fileArray = Gdx.files.internal("images").list();
    for(int i=0; i<fileArray.length; i++){
        //if it is not a directory
        if(!(fileArray[i].isDirectory())){
                String stringPath = fileArray[i].path();
            //load file
                manager.load(stringPath, Texture.class);
        }
    }

this works, but it takes a lot of time compared to the previous method. first of all, why? Is this its adoption time due to getting a list of FileHandle instances? and secondly, is there a way to load all the images from the catalog into the object manager as Textures that won't last so long?

+4
source share
1 answer

:

, TextureAtlas. , (. ) ( ) GUI.

.

  • .
  • (POT). .
  • , ( ), POT .
  • , . , , .
+4

Source: https://habr.com/ru/post/1542045/


All Articles