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(!(fileArray[i].isDirectory())){
String stringPath = fileArray[i].path();
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?
source
share