public void findTexturesFromDirectory(File dir, Collection<BackgroundTextureInfo> listToAppend) { for (File f : dir.listFiles()) { if (!f.isDirectory()) { BackgroundTextureInfo item = BackgroundTextureInfo.fromFile(f.getAbsolutePath()); if (item != null) listToAppend.add(item); } } }
public BackgroundTextureInfo getTextureInfoById(String id) { if (id == null) return NO_TEXTURE; if (id.startsWith("/")) { BackgroundTextureInfo item = BackgroundTextureInfo.fromFile(id); if (item != null) return item; } else { for (BackgroundTextureInfo item : internalTextures) if (item.id.equals(id)) return item; } return NO_TEXTURE; }
public byte[] getImageData(BackgroundTextureInfo texture) { if (texture.isNone()) return null; if (texture.resourceId != 0) { byte[] data = loadResourceBytes(texture.resourceId); return data; } else if (texture.id != null && texture.id.startsWith("/")) { File f = new File(texture.id); byte[] data = loadResourceBytes(f); return data; } return null; }