Hello, I’m trying to find out if I should be adding many disposable objects to a list, then when on closing, I can just loop through the array with .dispose(); to close everything.
Does something like this actually dispose of every object in an array, the same way as calling .dispose() on the item itself would?
For example:
BitmapFont bf = new BitmapFont();
bf.dispose();
This is what I’m trying:
List<Disposable> disposable = new ArrayList<>();
Sprite sprite;
public Menu(Sprite sprite) {
this.sprite = sprite;
disposable.add(this.sprite.getTexture());
}
public void disposeAll() {
for(Disposable d:disposable)
d.dispose();
}
It gives me no errors because all of the .dispose() capable objects implement Disposable.
I just can’t figure out if it is actually closing or not :s
Thanks muchly!