diff --git a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlSubsystem.java b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlSubsystem.java index 0a3d36f..64ada5a 100644 --- a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlSubsystem.java +++ b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlSubsystem.java @@ -150,12 +150,19 @@ public final class OpenGlSubsystem implements ApiMainClass { } /** - * Shuts the graphics subsystem down. + * Called when the engine shuts down. * - * @since v1-alpha0 + * @since v1-alpha2 */ - public static void shutdownApi() { - LoggerInstance logger = instance.logger; + @EventListener(event = InternalEngineShutdownEvent.class, priority = EventPriority.EXTREMELY_UNIMPORTANT) + private static void shutdownApiFromEvent() { + if (instance != null) + instance.shutdownApi(); + } + + /** {@inheritDoc} */ + @Override + public void shutdownApi() { logger.verb("Shutting down"); @SuppressWarnings("resource") diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/ApiMainClass.java b/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/ApiMainClass.java index fbb0f53..82d29f7 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/ApiMainClass.java +++ b/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/ApiMainClass.java @@ -22,8 +22,6 @@ package de.staropensource.sosengine.graphics.classes; import de.staropensource.sosengine.base.Engine; import de.staropensource.sosengine.base.annotations.EventListener; import de.staropensource.sosengine.base.classes.SubsystemMainClass; -import de.staropensource.sosengine.base.internal.events.InternalEngineShutdownEvent; -import de.staropensource.sosengine.base.types.EventPriority; import de.staropensource.sosengine.graphics.events.GraphicsErrorEvent; import org.jetbrains.annotations.NotNull; @@ -41,6 +39,17 @@ public interface ApiMainClass extends SubsystemMainClass { */ void initializeApi(); + /** + * Shuts the Graphics API down. + *

+ * Called when the engine shuts down. + * + * @see Engine#shutdown() + * @see Engine#shutdown(int) + * @since v1-alpha0 + */ + void shutdownApi(); + /** * Returns the name of the Graphics API. * @@ -85,14 +94,4 @@ public interface ApiMainClass extends SubsystemMainClass { */ @EventListener(event = GraphicsErrorEvent.class) static void onGraphicsError(String error) {} - - /** - * Called when the engine shuts down. - * - * @see Engine#shutdown() - * @see Engine#shutdown(int) - * @since v1-alpha0 - */ - @EventListener(event = InternalEngineShutdownEvent.class, priority = EventPriority.EXTREMELY_UNIMPORTANT) - static void shutdownApi() {} }