mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
add dispose for GifAnimation
This commit is contained in:
@@ -1476,7 +1476,6 @@ public class FSkin {
|
||||
addEncodingSymbol("TK", FSkinProp.IMG_TICKET);
|
||||
addEncodingSymbol("EXPERIENCE", FSkinProp.IMG_EXPERIENCE);
|
||||
addEncodingSymbol("A-", FSkinProp.IMG_ALCHEMY);
|
||||
addEncodingSymbol("M", FSkinProp.ICO_MANASHARD);
|
||||
|
||||
// Set look and feel after skin loaded
|
||||
FView.SINGLETON_INSTANCE.setSplashProgessBarMessage("Setting look and feel...");
|
||||
|
||||
@@ -997,13 +997,14 @@ public class Forge implements ApplicationListener {
|
||||
currentScreen = null;
|
||||
}
|
||||
FOverlay.hideAll();
|
||||
assets.dispose();
|
||||
Dscreens.clear();
|
||||
graphics.dispose();
|
||||
SoundSystem.instance.dispose();
|
||||
try {
|
||||
ExceptionHandler.unregisterErrorHandling();
|
||||
lastPreview.dispose();
|
||||
assets.dispose();
|
||||
AdventureScreen.dispose();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,14 @@ public class GifAnimation extends ForgeAnimation {
|
||||
@Override
|
||||
protected void onEnd(boolean endingAll) {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
if (animation != null) {
|
||||
for (TextureRegion tr: animation.getKeyFrames()) {
|
||||
try {
|
||||
tr.getTexture().dispose();
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -712,6 +712,7 @@ public class GifDecoder {
|
||||
}
|
||||
|
||||
Texture texture = new Texture(target);
|
||||
target.dispose();
|
||||
Array<TextureRegion> texReg = new Array<>();
|
||||
|
||||
for(h = 0; h < hzones; h++) {
|
||||
|
||||
@@ -64,4 +64,10 @@ public class AdventureScreen extends LaunchScreen {
|
||||
if (Gdx.files.absolute(demo).exists())
|
||||
animation = new GifAnimation(demo, Animation.PlayMode.LOOP);
|
||||
}
|
||||
public static void dispose() {
|
||||
if (animation != null) {
|
||||
animation.dispose();
|
||||
}
|
||||
animation = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user