Fix Graphics API shutdown logic
This commit is contained in:
parent
aaa81e2f87
commit
e8b9642177
2 changed files with 22 additions and 16 deletions
|
@ -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")
|
||||
|
|
|
@ -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.
|
||||
* <p>
|
||||
* 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() {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue