Last active
April 4, 2016 19:31
-
-
Save tdgroot/a05d669208a05f98e8074761af5aad98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DisposableEngine extends Engine { | |
public void dispose() { | |
ImmutableArray<Entity> entities = getEntities(); | |
for (Entity e : entities) { | |
ImmutableArray<Component> components = e.getComponents(); | |
for (Component component : components) { | |
if (!(component instanceof Disposable)) continue; | |
Disposable disposable = (Disposable) component; | |
disposable.dispose(); | |
Gdx.app.log("Disposed", disposable.toString()); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DrawingComponent implements Component, Disposable { | |
public Sprite sprite = new Sprite(); | |
public void dispose() { | |
sprite.getTexture().dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment