Revert "Add support for disposing GUIs"
This reverts commit 9bc79e940e.
This commit is contained in:
@@ -47,8 +47,6 @@ public interface Context extends Updatable, Renderable, Disposable {
|
||||
|
||||
GUI newGUI();
|
||||
|
||||
void disposeGUI(GUI gui);
|
||||
|
||||
Sound createSound(String soundUid);
|
||||
|
||||
void withDatabase(UncheckedConsumer<Connection, SQLException> consumer);
|
||||
|
||||
@@ -38,7 +38,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
@@ -101,7 +100,7 @@ public class DefaultContext implements Context {
|
||||
@Getter
|
||||
private boolean paused;
|
||||
|
||||
private final List<GUI> guis = new ArrayList<>();
|
||||
private final List<GUI> guis = new LinkedList<>();
|
||||
private final List<Sound> sounds = new LinkedList<>();
|
||||
|
||||
private final EventHandler eventHandler = new EventHandler();
|
||||
@@ -171,12 +170,6 @@ public class DefaultContext implements Context {
|
||||
return gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeGUI(GUI gui) {
|
||||
guis.remove(gui);
|
||||
gui.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sound createSound(String soundUid) {
|
||||
return soundManager.loadObject(soundUid);
|
||||
@@ -281,7 +274,6 @@ public class DefaultContext implements Context {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||
@Override
|
||||
public void update(float dt) {
|
||||
gameRunner.update(dt);
|
||||
@@ -296,8 +288,8 @@ public class DefaultContext implements Context {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < guis.size(); ++i) {
|
||||
guis.get(i).update(dt);
|
||||
for (var gui : guis) {
|
||||
gui.update(dt);
|
||||
}
|
||||
|
||||
for (var iterator = sounds.iterator(); iterator.hasNext(); ) {
|
||||
@@ -309,15 +301,14 @@ public class DefaultContext implements Context {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("ForLoopReplaceableByForEach")
|
||||
@Override
|
||||
public void render(Screen screen, Camera camera, ShaderManager shaderManager) {
|
||||
if (map != null) {
|
||||
map.render(screen, camera, shaderManager);
|
||||
}
|
||||
|
||||
for (int i = 0; i < guis.size(); ++i) {
|
||||
guis.get(i).render(screen, camera, shaderManager);
|
||||
for (var gui : guis) {
|
||||
gui.render(screen, camera, shaderManager);
|
||||
}
|
||||
|
||||
if (mapHandler != null) {
|
||||
|
||||
Reference in New Issue
Block a user