mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-23 21:21:28 +07:00
Additional functions in AssetUtils for disposing gdx assets quietly
This commit is contained in:
parent
410ce17498
commit
0f226739d1
@ -1,6 +1,7 @@
|
||||
package com.riiablo.asset;
|
||||
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
|
||||
public final class AssetUtils {
|
||||
private AssetUtils() { }
|
||||
@ -8,4 +9,22 @@ public final class AssetUtils {
|
||||
public static void dispose(Object o) {
|
||||
if (o instanceof Disposable) ((Disposable) o).dispose();
|
||||
}
|
||||
|
||||
public static void disposeQuietly(Object[] o) {
|
||||
disposeQuietly(o, 0, o.length);
|
||||
}
|
||||
|
||||
public static void disposeQuietly(Object[] o, int off, int len) {
|
||||
for (; off < len; off++) {
|
||||
disposeQuietly(o[off]);
|
||||
o[off] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void disposeQuietly(Object o) {
|
||||
try {
|
||||
dispose(o);
|
||||
} catch (GdxRuntimeException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user