示例#1
0
 public void loadEmitterImages(FileHandle imagesDir) {
   for (int i = 0, n = emitters.size; i < n; i++) {
     ParticleEmitter emitter = emitters.get(i);
     String imagePath = emitter.getImagePath();
     if (imagePath == null) continue;
     String imageName = new File(imagePath.replace('\\', '/')).getName();
     emitter.setSprite(new Sprite(loadTexture(imagesDir.child(imageName))));
   }
 }
示例#2
0
 public void loadEmitterImages(TextureAtlas atlas) {
   for (int i = 0, n = emitters.size; i < n; i++) {
     ParticleEmitter emitter = emitters.get(i);
     String imagePath = emitter.getImagePath();
     if (imagePath == null) continue;
     String imageName = new File(imagePath.replace('\\', '/')).getName();
     int lastDotIndex = imageName.lastIndexOf('.');
     if (lastDotIndex != -1) imageName = imageName.substring(0, lastDotIndex);
     Sprite sprite = atlas.createSprite(imageName);
     if (sprite == null)
       throw new IllegalArgumentException("SpriteSheet missing image: " + imageName);
     emitter.setSprite(sprite);
   }
 }