@Override public void update(final float delta) { int i = 0; for (; i < BUFFER_SIZE && currentImagesIndex < images.size(); i++) { assetWatcher.add(images.get(currentImagesIndex).getImage()); currentImagesIndex++; } for (; i < BUFFER_SIZE && currentSoundsIndex < sounds.size(); i++) { final Sound[] curSounds = sounds.get(currentSoundsIndex).getSounds(); for (final Sound sound : curSounds) { assetWatcher.add(sound); } currentSoundsIndex++; } for (; i < BUFFER_SIZE && currentMusicsIndex < musics.size(); i++) { assetWatcher.add(musics.get(currentMusicsIndex).getSound()); currentMusicsIndex++; } if (assetWatcher.isDone()) { GameLoop.instance().deregister(this); } }
public void loadResources() { assetWatcher.start(); GameLoop.instance().register(this); }