@SuppressWarnings("unchecked") public static <T> T load(Class<T> type, String filepath, Object... parameters) { T output = null; setAssetClass(type); try { if (gameAsset == null) gameAsset = new DefaultGameAsset(); if (type == Texture.class) { if (parameters.length == 0) output = (T) gameAsset.loadTexture(filepath); else if (parameters.length == 1) { output = (T) gameAsset.loadTexture(filepath, (Format) parameters[0], true); } else if (parameters.length == 2) { output = (T) gameAsset.loadTexture(filepath, (Format) parameters[0], (Boolean) parameters[1]); } else { throw new GdxRuntimeException("Parameters is not valid!"); } } else if (type == BitmapFont.class) { if (parameters.length == 0) output = (T) gameAsset.loadBitmapFont(filepath); else if (parameters.length == 1) { output = (T) gameAsset.loadBitmapFont(filepath, (String) parameters[0]); } else { throw new GdxRuntimeException("Parameters is not valid!"); } } else if (type == TextureRegion.class) { if (parameters.length == 0) output = (T) gameAsset.loadTextureRegion(filepath); else if (parameters.length == 1) { output = (T) gameAsset.loadTextureRegion(filepath, (Rectangle) parameters[0]); } else if (parameters.length == 2) { output = (T) gameAsset.loadTextureRegion( (Texture) parameters[0], (Rectangle) parameters[1]); } else { throw new GdxRuntimeException("Parameters is not valid!"); } } else if (type == Music.class) { if (parameters.length == 0) output = (T) gameAsset.loadMusic(filepath); else if (parameters.length == 1) { output = (T) gameAsset.loadMusic(filepath, (Float) parameters[0]); } else { throw new GdxRuntimeException("Parameters is not valid!"); } } else if (type == Audio.class) { if (parameters.length == 0) output = (T) gameAsset.loadSound(filepath); } else if (type == ShaderProgram.class) { if (parameters.length == 0) output = (T) gameAsset.loadShader(filepath); else if (parameters.length == 1) { output = (T) gameAsset.loadShader(filepath, (String) parameters[0]); } else { throw new GdxRuntimeException("Parameters is not valid!"); } } else if (type == StillModel.class) { if (parameters.length == 0) output = (T) gameAsset.loadModel(filepath); } } catch (Exception ex) { throw new GdxRuntimeException("Invalid parameters you passed"); } return output; }
@Override public Audio getAudio () { return audio; }
@Override public Audio getAudio() { return audio; }
@Override public Audio getAudio() { return Gdx.audio; }
public Audio getAudio () { return null; }
@Override public Audio getAudio () { return Gdx.audio; }
public Audio getAudio() { return this.audio; }