destroy even more images when closing
This commit is contained in:
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
package yugecin.opsudance.core;
|
||||
|
||||
import itdelatrisu.opsu.GameData;
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.Options;
|
||||
import itdelatrisu.opsu.audio.MusicController;
|
||||
import itdelatrisu.opsu.beatmap.Beatmap;
|
||||
import itdelatrisu.opsu.ui.Fonts;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.openal.AL;
|
||||
@@ -213,7 +215,9 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||
|
||||
public void teardown() {
|
||||
InternalTextureLoader.get().clear();
|
||||
GameImage.destroyAll();
|
||||
GameImage.destroyImages();
|
||||
GameData.Grade.destroyImages();
|
||||
Beatmap.destroyBackgroundImageCache();
|
||||
Display.destroy();
|
||||
}
|
||||
|
||||
|
||||
44
src/yugecin/opsudance/utils/SlickUtil.java
Normal file
44
src/yugecin/opsudance/utils/SlickUtil.java
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* opsu!dance - fork of opsu! with cursordance auto
|
||||
* Copyright (C) 2017 yugecin
|
||||
*
|
||||
* opsu!dance is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* opsu!dance is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with opsu!dance. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package yugecin.opsudance.utils;
|
||||
|
||||
import org.newdawn.slick.Image;
|
||||
import org.newdawn.slick.SlickException;
|
||||
|
||||
public class SlickUtil {
|
||||
|
||||
public static void destroyImages(Image[] imgs) {
|
||||
if (imgs == null) {
|
||||
return;
|
||||
}
|
||||
for (Image i : imgs) {
|
||||
destroyImage(i);
|
||||
}
|
||||
}
|
||||
|
||||
public static void destroyImage(Image image) {
|
||||
if (image == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
image.destroy();
|
||||
} catch (SlickException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user