finished 12

This commit is contained in:
Cedric Beck
2024-10-08 14:22:42 +02:00
parent 5edd4ebe0b
commit 4492843ca1
19 changed files with 350 additions and 52 deletions

View File

@@ -7,14 +7,14 @@
package pp.util;
import com.jme3.app.Application;
import com.jme3.asset.AssetLoadException;
import com.jme3.asset.AssetNotFoundException;
import com.jme3.audio.AudioData;
import com.jme3.audio.AudioNode;
//import com.jme3.app.Application;
//import com.jme3.asset.AssetLoadException;
//import com.jme3.asset.AssetNotFoundException;
//import com.jme3.audio.AudioData;
//import com.jme3.audio.AudioNode;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
//import java.lang.System.Logger.Level;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -25,8 +25,6 @@
* A class with auxiliary functions.
*/
public class Util {
private static final Logger LOGGER = System.getLogger(Util.class.getName());
private Util() { /* do not instantiate */ }
/**
@@ -97,24 +95,4 @@ public static <T, E extends T> Set<T> add(Set<T> set, E element) {
newSet.add(element);
return newSet;
}
/**
* Loads a sound from the specified file.
*
* @param app The application
* @param name The name of the sound file.
* @return The loaded AudioNode.
*/
public static AudioNode loadSound(Application app, String name) {
try {
final AudioNode sound = new AudioNode(app.getAssetManager(), name, AudioData.DataType.Buffer);
sound.setLooping(false);
sound.setPositional(false);
return sound;
}
catch (AssetLoadException | AssetNotFoundException ex) {
LOGGER.log(Level.ERROR, ex.getMessage(), ex);
}
return null;
}
}