Legger til korrekt fjerning av innlastede ressurser brukt i TextureConverterUtil

This commit is contained in:
2020-03-02 10:16:09 +01:00
parent 983c27f745
commit 9d914ad748
2 changed files with 21 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package inf112.fiasko.roborally.utility;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Disposable;
import inf112.fiasko.roborally.element_properties.Direction;
import inf112.fiasko.roborally.element_properties.RobotID;
import inf112.fiasko.roborally.element_properties.TileType;
@ -15,7 +16,9 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -32,6 +35,19 @@ public final class TextureConverterUtil {
private TextureConverterUtil() {}
/**
* Gets a list of all disposable elements which should be disposed when the software closes
* @return A list of disposable elements
*/
public static List<Disposable> getDisposableElements() {
List<Disposable> disposables = new ArrayList<>();
disposables.add(textureSheet);
disposables.add(robot1Texture);
disposables.add(robot2Texture);
disposables.add(robot3Texture);
return disposables;
}
/**
* Gets the texture representing the tile
* @param tile The tile to draw