Add ApiInternalClass and OpenGL equivalent

This commit is contained in:
JeremyStar™ 2024-07-21 16:45:28 +02:00
parent 7962a15c12
commit 051f3eaacc
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
4 changed files with 96 additions and 1 deletions

View file

@ -0,0 +1,33 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Contributors
* Licensed under the GNU Affero General Public License v3
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.opengl;
import de.staropensource.sosengine.graphics.classes.ApiInternalClass;
import de.staropensource.sosengine.graphics.classes.Window;
import org.jetbrains.annotations.NotNull;
public class OpenGlInternalApi implements ApiInternalClass {
/** {@inheritDoc} */
@Override
@NotNull
public Class<? extends Window> getWindowClass() {
return de.staropensource.sosengine.graphics.opengl.classes.Window.class;
}
}

View file

@ -31,6 +31,7 @@ import de.staropensource.sosengine.base.types.EventPriority;
import de.staropensource.sosengine.base.types.logging.LogIssuer; import de.staropensource.sosengine.base.types.logging.LogIssuer;
import de.staropensource.sosengine.base.utility.Miscellaneous; import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.graphics.GraphicsSubsystem; import de.staropensource.sosengine.graphics.GraphicsSubsystem;
import de.staropensource.sosengine.graphics.classes.ApiInternalClass;
import de.staropensource.sosengine.graphics.classes.ApiMainClass; import de.staropensource.sosengine.graphics.classes.ApiMainClass;
import de.staropensource.sosengine.graphics.classes.ApiManagementClass; import de.staropensource.sosengine.graphics.classes.ApiManagementClass;
import de.staropensource.sosengine.graphics.events.GraphicsApiErrorEvent; import de.staropensource.sosengine.graphics.events.GraphicsApiErrorEvent;
@ -74,6 +75,18 @@ public final class OpenGlSubsystem implements ApiMainClass {
*/ */
private final LoggerInstance logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE)); private final LoggerInstance logger = new LoggerInstance(new LogIssuer(getClass(), CodePart.ENGINE));
/**
* The Graphics API's internal API class.
*
* @see ApiInternalClass
* @since v1-alpha0
*
* -- GETTER --
* {@inheritDoc}
*/
@Getter
private ApiInternalClass internalApi;
/** /**
* The Graphics API's management class. * The Graphics API's management class.
* *
@ -133,6 +146,7 @@ public final class OpenGlSubsystem implements ApiMainClass {
logger.crash("Unable to initialize GLFW"); logger.crash("Unable to initialize GLFW");
// Initialize management class // Initialize management class
internalApi = new OpenGlInternalApi();
management = new OpenGlManagement(); management = new OpenGlManagement();
}); });

View file

@ -0,0 +1,38 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Contributors
* Licensed under the GNU Affero General Public License v3
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.classes;
import org.jetbrains.annotations.NotNull;
/**
* The interface for internal API access, used by the graphics subsystem.
*
* @since v1-alpha2
*/
@SuppressWarnings({ "unused" })
public interface ApiInternalClass {
/**
* Returns the {@link Window} class.
*
* @return {@link Window} class
*/
@NotNull
Class<? extends Window> getWindowClass();
}

View file

@ -50,7 +50,17 @@ public interface ApiMainClass extends SubsystemMainClass {
String getApiName(); String getApiName();
/** /**
* Returns the API's management class. * Returns the Graphics API's internal API access class.
*
* @return a {@link ApiInternalClass}
* @see ApiInternalClass
* @since v1-alpha2
*/
@NotNull
ApiInternalClass getInternalApi();
/**
* Returns the Graphics API's management class.
* *
* @return a {@link ApiManagementClass} * @return a {@link ApiManagementClass}
* @see ApiManagementClass * @see ApiManagementClass