Example #1
0
 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);
     }
   }
 }
Example #2
0
 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;
 }
Example #3
0
 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;
 }