mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-31 18:04:21 +07:00
...and faster music loading
This commit is contained in:
parent
d84b981d24
commit
5b48faf13b
@ -98,7 +98,40 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
|
||||
}
|
||||
}
|
||||
});
|
||||
assets.setLoader(Music.class, new MusicLoader(tree));
|
||||
assets.setLoader(Music.class, new MusicLoader(tree){
|
||||
@Override
|
||||
public void loadAsync(AssetManager manager, String fileName, Fi file, MusicParameter parameter){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Music loadSync(AssetManager manager, String fileName, Fi file, MusicParameter parameter){
|
||||
|
||||
if(parameter != null && parameter.music != null){
|
||||
mainExecutor.submit(() -> {
|
||||
try{
|
||||
parameter.music.load(file);
|
||||
}catch(Throwable t){
|
||||
Log.err("Error loading music: " + file, t);
|
||||
}
|
||||
});
|
||||
|
||||
return parameter.music;
|
||||
}else{
|
||||
Music music = new Music();
|
||||
|
||||
mainExecutor.submit(() -> {
|
||||
try{
|
||||
music.load(file);
|
||||
}catch(Throwable t){
|
||||
Log.err("Error loading music: " + file, t);
|
||||
}
|
||||
});
|
||||
|
||||
return music;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
assets.load("sprites/error.png", Texture.class);
|
||||
atlas = TextureAtlas.blankAtlas();
|
||||
|
Loading…
Reference in New Issue
Block a user