Nuke 'graphics', welcome 'windowing'
All checks were successful
build-and-test / test (push) Successful in 2m1s
build-and-test / generate-javadoc (push) Successful in 2m14s
build-and-test / build (push) Successful in 2m17s

This commit is contained in:
JeremyStar™ 2024-08-20 21:01:39 +02:00
parent a550f0a16a
commit 701f316950
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
93 changed files with 338 additions and 1294 deletions

View file

@ -31,10 +31,8 @@ tasks.register("javadocAll", Javadoc) {
":base",
":ansi",
":slf4j-compat",
":graphics",
":graphics:glfw",
":graphics:opengl",
":graphics:vulkan",
":windowing",
":windowing:glfw",
]
// Task metadata

View file

@ -13,8 +13,8 @@ This is enough to initialize the engine and all installed subsystems. No need to
## Printing something
Now you'll probably want to print some log output. Before you try using `System.out#println`,
`java.util.logging`, Log4J, SLFJ or some other logging library, please don't! The engine
provides it's own logging implementation and is HIGHLY recommended to be used instead.
`java.util.logging`, Log4J, SLF4J or some other logging library, please don't! The engine
provides it's own logging implementation and is HIGHLY recommended to be used over other implementations.
There are eight log levels you can use:
<table>

View file

@ -9,3 +9,5 @@ The engine API documentation covers the core engine and all official subsystems.
- [Latest commit (updates every hour)](https://jd.engine.staropensource.de/develop/)
- [v1-alpha0](https://jd.engine.staropensource.de/v1-alpha0/)
- [v1-alpha1](https://jd.engine.staropensource.de/v1-alpha1/)
- [v1-alpha2](https://jd.engine.staropensource.de/v1-alpha2/)
- [v1-alpha3](https://jd.engine.staropensource.de/v1-alpha3/)

View file

@ -13,15 +13,15 @@ Welcome to the documentation for the StarOpenSource Engine!
## What is it?
The StarOpenSource Engine (or **sos!engine** for short) is a modular, extensible and easy to use Java game and application engine. \
It is responsible for the logging infrastructure, displaying stuff to a monitor, talking with graphics cards, playing audio, displaying UIs and much more.
It is responsible for the logging infrastructure, creating and managing windows, playing audio and much more.
## Why another one?
Yeah, it's true that there are many game engines and frameworks out there that intend to ease development of applications and games.
I ([JeremyStarTM](https://git.staropensource.de/JeremyStarTM)) however have never seen an engine or framework that can be extended easily.
I ([JeremyStarTM](https://git.staropensource.de/JeremyStarTM)) however have never seen an engine or framework, which can be extended easily, without having to fork it and without a complicated development setup.
And I don't mean what you make within the bounds of the engine or framework, no, I mean the engine/framework itself.
## Architecture of the engine
The engine consists of the core engine (`base` dependency in your project) and various subsystems (`slf4j-compat`, `graphics`, etc.). \
The engine consists of the core engine (`base` dependency in your project) and various subsystems (`slf4j-compat`, `windowing`, etc.). \
\
The job of the base engine is to provide minimal classes and interfaces needed for an application.
It contains among other things a default logger implementation, useful methods, event system and a placeholder system. \
@ -35,11 +35,8 @@ Besides the `base` engine, there is one stable subsystem, two experimental subsy
- [`ansi`](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/ansi): Provides an ANSI logging implementation and a ShortcodeParserSkeleton implementation
- [`slf4j-compat`](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/slf4j-compat): Provides [SLF4J](https://slf4j.org/) compatibility logger that redirects all log calls to the engine.
### Experimental
- [`graphics`](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/graphics): Provides interfaces and classes meant to be extended by Graphics APIs.
- [`graphics-glfw`](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/graphics/glfw): Provides common GLFW code, meant to be used and extended by Graphics APIs using GLFW.
- [`graphics-opengl`](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/graphics/opengl): Provides the OpenGL Graphics API.
### Stub
- [`graphics-vulkan`](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/graphics/vulkan): Provides the Vulkan Graphics API. 100% unfinished, planned in the future.
- [`windowing`](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/windowing): Provides abstract APIs for creating and managing windows and monitors.
- [`windowing-glfw`](https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/windowing/glfw): Windowing API, allowing GLFW to be used for creating windows and recieving input.
## API documentation
To read the engine API documentation, visit [jd.engine.staropensource.de](https://jd.engine.staropensource.de).

View file

@ -1,2 +0,0 @@
# The `graphics` subsystem
This subsystem is essential for displaying graphics to the screen, though requires a Graphics API to do anything. It provides among other things interfaces that Graphics APIs can implement.

View file

@ -1,30 +0,0 @@
import de.staropensource.sosengine.graphics.classes.Window;
/**
* The {@code glfw} subsystem, which allows Graphics APIs to
* create {@link Window} without any hassle and allows their
* developers to focus on what's important: Graphics API development.
*
* @since v1-alpha2
*/
module sosengine.graphics.glfw {
// Dependencies
// -> Subsystems
requires transitive sosengine.base;
requires transitive sosengine.graphics;
// -> Libraries
requires transitive static lombok;
requires transitive org.jetbrains.annotations;
requires org.lwjgl;
requires org.lwjgl.glfw;
// API access
exports de.staropensource.sosengine.graphics.glfw;
exports de.staropensource.sosengine.graphics.glfw.classes;
exports de.staropensource.sosengine.graphics.glfw.exceptions;
// Reflection access
opens de.staropensource.sosengine.graphics.glfw;
opens de.staropensource.sosengine.graphics.glfw.classes;
opens de.staropensource.sosengine.graphics.glfw.exceptions;
}

View file

@ -1,2 +0,0 @@
# The `opengl` subsystem
This subsystem is a Graphics API, bringing OpenGL into the engine.

View file

@ -1,146 +0,0 @@
/*
* 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/>.
*/
import org.gradle.internal.os.OperatingSystem
// Plugins
plugins {
id("java")
id("io.freefair.lombok") version("${pluginLombok}")
}
// Determine operating system and architecture
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
project.dependencyLwjglNatives = "natives-linux"
def osArch = System.getProperty("os.arch")
if (osArch.startsWith("arm") || osArch.startsWith("aarch64")) {
project.dependencyLwjglNatives += osArch.contains("64") || osArch.startsWith("armv8") ? "-arm64" : "-arm32"
} else if (osArch.startsWith("ppc")) {
project.dependencyLwjglNatives += "-ppc64le"
} else if (osArch.startsWith("riscv")) {
project.dependencyLwjglNatives += "-riscv64"
}
break
case OperatingSystem.MAC_OS:
project.dependencyLwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos"
break
case OperatingSystem.WINDOWS:
def osArch = System.getProperty("os.arch")
project.dependencyLwjglNatives = osArch.contains("64")
? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}"
: "natives-windows-x86"
break
}
// Dependencies
dependencies {
// -> Runtime <-
// Lombok
compileOnly("org.projectlombok:lombok:${dependencyLombok}")
annotationProcessor("org.projectlombok:lombok:${dependencyLombok}")
// JetBrains Annotations
compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
// LWJGL
implementation(platform("org.lwjgl:lwjgl-bom:${dependencyLwjgl}"))
implementation("org.lwjgl:lwjgl")
implementation("org.lwjgl:lwjgl-glfw")
implementation("org.lwjgl:lwjgl-opengl")
implementation("org.lwjgl:lwjgl-opengles")
runtimeOnly("org.lwjgl:lwjgl::${dependencyLwjglNatives}")
runtimeOnly("org.lwjgl:lwjgl-glfw::${dependencyLwjglNatives}")
runtimeOnly("org.lwjgl:lwjgl-opengl::${dependencyLwjglNatives}")
runtimeOnly("org.lwjgl:lwjgl-opengles::${dependencyLwjglNatives}")
if (project.dependencyLwjglNatives == "natives-macos" || project.dependencyLwjglNatives == "natives-macos-arm64") runtimeOnly("org.lwjgl:lwjgl-vulkan::${dependencyLwjglNatives}")
// -> Testing <-
// Jetbrains Annotations
testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
// JUnit
testImplementation(platform("org.junit:junit-bom:${dependencyJunit}"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// -> Project <-
implementation(project(":base"))
implementation(project(":graphics"))
implementation(project(":graphics:glfw"))
}
// Fix delombok task
delombok.doFirst {
File target = file("${project.projectDir}/src/main/module-info.java")
File source = file("${project.projectDir}/src/main/java/module-info.java")
target.delete()
source.renameTo(target)
}
delombok.doLast {
File target = file("${project.projectDir}/src/main/java/module-info.java")
File source = file("${project.projectDir}/src/main/module-info.java")
target.delete()
source.renameTo(target)
}
// Javadoc configuration
javadoc {
outputs.upToDateWhen { false } // Force task execution
dependsOn(delombok) // Make sure the source is delomboked first
javadoc {
setClasspath(files(project.sourceSets.main.compileClasspath)) // Include dependencies
options {
if (new File(projectDir, "src/main/javadoc/theme.css").exists())
stylesheetFile = new File(projectDir, "src/main/javadoc/theme.css") // Theming is cool :3
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above
])
}
}
}
// Unit testing configuration
test {
useJUnitPlatform()
// Pass test configuration to test VMs
Map<String, String> testConfiguration = new HashMap<>();
for (String property : project.properties.keySet())
if (property.startsWith("test."))
testConfiguration.put(property, project.properties.get(property).toString())
systemProperties(testConfiguration)
setMaxParallelForks(project.hasProperty("jobs") ? Integer.parseInt((String) project.property("jobs")) : 8)
setForkEvery(1)
setFailFast(true)
testLogging {
events("passed", "skipped", "failed")
}
}

View file

@ -1 +0,0 @@
../../gradle

View file

@ -1 +0,0 @@
../../gradlew

View file

@ -1 +0,0 @@
../../gradlew.bat

View file

@ -1,53 +0,0 @@
/*
* 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.Monitor;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.glfw.classes.GlfwInternalClass;
import de.staropensource.sosengine.graphics.glfw.classes.GlfwMonitor;
import de.staropensource.sosengine.graphics.opengl.classes.OpenGlWindow;
import org.jetbrains.annotations.NotNull;
/**
* The internal API class of the OpenGL Graphics API.
*
* @since v1-alpha2
*/
public final class OpenGlInternalApi extends GlfwInternalClass {
/**
* Constructs this class.
*
* @since v1-alpha2
*/
public OpenGlInternalApi() {}
/** {@inheritDoc} */
@Override
public @NotNull Class<? extends Window> getWindowClass() {
return OpenGlWindow.class;
}
/** {@inheritDoc} */
@Override
public @NotNull Class<? extends Monitor> getMonitorClass() {
return GlfwMonitor.class;
}
}

View file

@ -1,36 +0,0 @@
/*
* 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.glfw.classes.GlfwManagementClass;
/**
* The management class of the OpenGL Graphics API.
*
* @since v1-alpha0
*/
public final class OpenGlManagement extends GlfwManagementClass {
/**
* Constructs this class.
*
* @since v1-alpha2
*/
public OpenGlManagement() {}
}

View file

@ -1,203 +0,0 @@
/*
* 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.base.annotations.EngineSubsystem;
import de.staropensource.sosengine.base.annotations.EventListener;
import de.staropensource.sosengine.base.data.information.EngineInformation;
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.DependencyVector;
import de.staropensource.sosengine.base.types.EventPriority;
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
import de.staropensource.sosengine.graphics.classes.api.ApiInternalClass;
import de.staropensource.sosengine.graphics.classes.api.ApiClass;
import de.staropensource.sosengine.graphics.classes.api.ApiManagementClass;
import de.staropensource.sosengine.graphics.events.GraphicsApiErrorEvent;
import de.staropensource.sosengine.graphics.events.GraphicsErrorEvent;
import de.staropensource.sosengine.graphics.glfw.GlfwSubsystem;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.system.MemoryUtil;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import static org.lwjgl.glfw.GLFW.*;
/**
* The main class of the OpenGL Graphics API.
*
* @since v1-alpha0
*/
@EngineSubsystem
@SuppressWarnings({ "JavadocDeclaration" })
public final class OpenGlSubsystem extends ApiClass {
/**
* Contains the class instance.
*
* @since v1-alpha0
* -- GETTER --
* Returns the class instance.
*
* @return class instance unless the subsystem is uninitialized
* @since v1-alpha0
*/
@Getter
private static OpenGlSubsystem instance = null;
/**
* Contains the {@link LoggerInstance} for this instance.
*
* @see LoggerInstance
* @since v1-alpha1
*/
private final @NotNull LoggerInstance logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin("ENGINE").build();
/**
* The Graphics API's internal API class.
*
* @see ApiInternalClass
* @since v1-alpha0
* -- GETTER --
* {@inheritDoc}
*/
@Getter
private ApiInternalClass internalApi;
/**
* The Graphics API's management class.
*
* @see ApiManagementClass
* @since v1-alpha0
* -- GETTER --
* {@inheritDoc}
*/
@Getter
private ApiManagementClass management;
/**
* Constructs this subsystem.
*
* @since v1-alpha0
*/
public OpenGlSubsystem() {
// Check if subsystem has already initialized
if (instance == null)
instance = this;
else {
instance.logger.crash("The subsystem tried to initialize twice");
}
}
/** {@inheritDoc} */
@Override
public @NotNull String getName() {
return getApiName().toLowerCase(Locale.ROOT);
}
/** {@inheritDoc} */
@Override
public void initializeSubsystem() {
// Register Graphics API
GraphicsSubsystem.getInstance().registerGraphicsApi(this);
}
/** {@inheritDoc} */
@Override
public void initializeApi() {
GlfwSubsystem.getInstance().initializeGlfw();
// Initialize management class
internalApi = new OpenGlInternalApi();
management = new OpenGlManagement();
}
/** {@inheritDoc} */
@Override
public void shutdownApi() {
GlfwSubsystem.getInstance().terminateGlfw();
}
/** {@inheritDoc} */
@Override
public @NotNull DependencyVector getDependencyVector() {
Set<@NotNull String> dependencies = new HashSet<>();
dependencies.add("graphics");
dependencies.add("glfw");
return new DependencyVector.Builder()
.setIdentifier(getName())
.setVersioningSystem(StarOpenSourceVersioningSystem.class)
.setVersion(EngineInformation.getVersioningString())
.setDependencies(dependencies)
.build();
}
/** {@inheritDoc} */
@Override
public String getApiName() {
return "OpenGL";
}
/** {@inheritDoc} */
@Override
public boolean isCompatible() {
// Set required version and profile
glfwWindowHint(GLFW_VISIBLE, 0);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Create test window
long window = glfwCreateWindow(0, 0, "sos!engine OpenGL Graphics API compatibility test", MemoryUtil.NULL, MemoryUtil.NULL);
boolean failed = window == MemoryUtil.NULL;
// Destroy window
if (!failed) glfwDestroyWindow(window);
return failed;
}
/**
* Called when an OpenGL error occurs. This method just logs the error and returns.
*
* @param error graphics error
* @since v1-alpha0
*/
@EventListener(event = GraphicsErrorEvent.class, priority = EventPriority.EXCLUSIVELY_IMPORTANT)
@SuppressWarnings({ "unused" })
public static void onGraphicsError(String error) {
instance.logger.error("OpenGL returned an error: " + error);
}
/**
* Called when a Graphics API error occurs. This method just logs the error and returns.
*
* @param error Graphics API error
* @since v1-alpha0
*/
@EventListener(event = GraphicsApiErrorEvent.class, priority = EventPriority.EXCLUSIVELY_IMPORTANT)
@SuppressWarnings({ "unused" })
public static void onGraphicsApiError(String error) {
instance.logger.error("Graphics API returned an error: " + error);
}
}

View file

@ -1,85 +0,0 @@
/*
* 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.classes;
import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException;
import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.graphics.classes.Monitor;
import de.staropensource.sosengine.graphics.glfw.classes.GlfwWindow;
import de.staropensource.sosengine.graphics.exceptions.NotOnMainThreadException;
import de.staropensource.sosengine.graphics.exceptions.WindowCreationFailureException;
import de.staropensource.sosengine.graphics.types.window.WindowMode;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.opengl.GL;
import static org.lwjgl.glfw.GLFW.*;
/**
* Implements a window which supports OpenGL.
*
* @since v1-alpha0
*/
public final class OpenGlWindow extends GlfwWindow {
// ------------------------------------------------ [ Window initialization ] ------------------------------------------------ //
/**
* Creates a new window.
*
* @param name name
* @param title title
* @param size size
* @param minimumSize minimum size
* @param maximumSize maximum size
* @param position position
* @param windowMode window mode
* @param monitor target monitor
* @param resizable resizable flag
* @param borderless borderless flag
* @param focusable focusable flag
* @param onTop on top flag
* @param transparent transparency flag
* @param rendering rendering flag
* @throws UnexpectedThrowableException stuff thrown by the {@link #initializeWindow()} and {@link #render()} methods of the implementing Graphics API
* @since v1-alpha2
*/
public OpenGlWindow(@NotNull String name, @NotNull String title, @NotNull Vec2i size, @NotNull Vec2i minimumSize, @NotNull Vec2i maximumSize, @NotNull Vec2i position, @NotNull WindowMode windowMode, @NotNull Monitor monitor, boolean resizable, boolean borderless, boolean focusable, boolean onTop, boolean transparent, boolean rendering) throws UnexpectedThrowableException {
super(name, title, size, minimumSize, maximumSize, position, windowMode, monitor, resizable, borderless, focusable, onTop, transparent, rendering);
}
/** {@inheritDoc} */
@Override
protected void initializeGlfwWindow() throws WindowCreationFailureException, NotOnMainThreadException {
ownContext(); // Own the context
GL.createCapabilities(); // Create OpenGL capabilities
}
/** {@inheritDoc} */
@Override
protected void updateGlfwState() throws NotOnMainThreadException {}
/** {@inheritDoc} */
@Override
protected void setWindowHints() {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
}
}

View file

@ -1,25 +0,0 @@
/*
* 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/>.
*/
/**
* Interfaces and abstract classes which can be used for implementing classes.
*
* @since v1-alpha0
*/
package de.staropensource.sosengine.graphics.opengl.classes;

View file

@ -1,25 +0,0 @@
/*
* 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/>.
*/
/**
* Code of the OpenGL Graphics API.
*
* @since v1-alpha0
*/
package de.staropensource.sosengine.graphics.opengl;

View file

@ -1,26 +0,0 @@
/**
* Defines the OpenGL Graphics API and {@code opengl} subsystem, which allows for communicating with the graphics card via OpenGL.
*
* @since v1-alpha1
*/
module sosengine.graphics.opengl {
// Dependencies
// -> Subsystems
requires transitive sosengine.base;
requires transitive sosengine.graphics;
// -> Libraries
requires transitive static lombok;
requires transitive org.jetbrains.annotations;
requires org.lwjgl;
requires org.lwjgl.glfw;
requires org.lwjgl.opengl;
requires sosengine.graphics.glfw;
// API access
exports de.staropensource.sosengine.graphics.opengl;
exports de.staropensource.sosengine.graphics.opengl.classes;
// Reflection access
opens de.staropensource.sosengine.graphics.opengl;
opens de.staropensource.sosengine.graphics.opengl.classes;
}

View file

@ -1 +0,0 @@
../../../../../src/main/javadoc/theme.css

View file

@ -1,32 +0,0 @@
/**
* The {@code graphics} subsystem, which provides abstractions and
* APIs with which graphics can be displayed on a user's screen.
*
* @since v1-alpha1
*/
module sosengine.graphics {
// Dependencies
// -> Subsystems
requires transitive sosengine.base;
// -> Libraries
requires transitive static lombok;
requires transitive org.jetbrains.annotations;
// API access
exports de.staropensource.sosengine.graphics;
exports de.staropensource.sosengine.graphics.classes;
exports de.staropensource.sosengine.graphics.classes.api;
exports de.staropensource.sosengine.graphics.events;
exports de.staropensource.sosengine.graphics.exceptions;
exports de.staropensource.sosengine.graphics.types.input;
exports de.staropensource.sosengine.graphics.types.window;
// Reflection access
opens de.staropensource.sosengine.graphics;
opens de.staropensource.sosengine.graphics.classes;
opens de.staropensource.sosengine.graphics.classes.api;
opens de.staropensource.sosengine.graphics.events;
opens de.staropensource.sosengine.graphics.exceptions;
opens de.staropensource.sosengine.graphics.types.input;
opens de.staropensource.sosengine.graphics.types.window;
}

View file

@ -1,24 +0,0 @@
<!--
~ 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/>.
-->
<body>
<p>Welcome to the sos!engine API documentation!<br/>
You are currently in the documentation for the <b>graphics</b> subsystem, which provides APIs for interfacing with Graphics APIs.</p>
<p>This subsystem largely does not provide any utility for your application, as it's interfaces and classes are meant to be implemented by Graphics APIs.</p>
</body>

View file

@ -1,2 +0,0 @@
# The `vulkan` subsystem
This subsystem is a Graphics API, bringing Vulkan into the engine. This Graphics API does not work at the moment.

View file

@ -1,143 +0,0 @@
/*
* 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/>.
*/
import org.gradle.internal.os.OperatingSystem
// Plugins
plugins {
id("java")
id("io.freefair.lombok") version("${pluginLombok}")
}
// Determine operating system and architecture
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
project.dependencyLwjglNatives = "natives-linux"
def osArch = System.getProperty("os.arch")
if (osArch.startsWith("arm") || osArch.startsWith("aarch64")) {
project.dependencyLwjglNatives += osArch.contains("64") || osArch.startsWith("armv8") ? "-arm64" : "-arm32"
} else if (osArch.startsWith("ppc")) {
project.dependencyLwjglNatives += "-ppc64le"
} else if (osArch.startsWith("riscv")) {
project.dependencyLwjglNatives += "-riscv64"
}
break
case OperatingSystem.MAC_OS:
project.dependencyLwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos"
break
case OperatingSystem.WINDOWS:
def osArch = System.getProperty("os.arch")
project.dependencyLwjglNatives = osArch.contains("64")
? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}"
: "natives-windows-x86"
break
}
// Dependencies
dependencies {
// -> Runtime <-
// Lombok
compileOnly("org.projectlombok:lombok:${dependencyLombok}")
annotationProcessor("org.projectlombok:lombok:${dependencyLombok}")
// JetBrains Annotations
compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
// LWJGL
implementation(platform("org.lwjgl:lwjgl-bom:${dependencyLwjgl}"))
implementation("org.lwjgl:lwjgl")
implementation("org.lwjgl:lwjgl-glfw")
implementation("org.lwjgl:lwjgl-vulkan")
runtimeOnly("org.lwjgl:lwjgl::${dependencyLwjglNatives}")
runtimeOnly("org.lwjgl:lwjgl-glfw::${dependencyLwjglNatives}")
if (project.dependencyLwjglNatives == "natives-macos" || project.dependencyLwjglNatives == "natives-macos-arm64") runtimeOnly("org.lwjgl:lwjgl-vulkan::${dependencyLwjglNatives}")
// -> Testing <-
// Jetbrains Annotations
testCompileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
// JUnit
testImplementation(platform("org.junit:junit-bom:${dependencyJunit}"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// -> Project <-
implementation(project(":base"))
implementation(project(":graphics"))
implementation(project(":graphics:glfw"))
}
// Fix delombok task
delombok.doFirst {
File target = file("${project.projectDir}/src/main/module-info.java")
File source = file("${project.projectDir}/src/main/java/module-info.java")
target.delete()
source.renameTo(target)
}
delombok.doLast {
File target = file("${project.projectDir}/src/main/java/module-info.java")
File source = file("${project.projectDir}/src/main/module-info.java")
target.delete()
source.renameTo(target)
}
// Javadoc configuration
javadoc {
outputs.upToDateWhen { false } // Force task execution
dependsOn(delombok) // Make sure the source is delomboked first
javadoc {
setClasspath(files(project.sourceSets.main.compileClasspath)) // Include dependencies
options {
if (new File(projectDir, "src/main/javadoc/theme.css").exists())
stylesheetFile = new File(projectDir, "src/main/javadoc/theme.css") // Theming is cool :3
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
setLocale("en_US") //
addStringOption("Xwerror", "-quiet") // Fail build on warning
setJFlags([
"-Duser.language=en_US" // See above
])
}
}
}
// Unit testing configuration
test {
useJUnitPlatform()
// Pass test configuration to test VMs
Map<String, String> testConfiguration = new HashMap<>();
for (String property : project.properties.keySet())
if (property.startsWith("test."))
testConfiguration.put(property, project.properties.get(property).toString())
systemProperties(testConfiguration)
setMaxParallelForks(project.hasProperty("jobs") ? Integer.parseInt((String) project.property("jobs")) : 8)
setForkEvery(1)
setFailFast(true)
testLogging {
events("passed", "skipped", "failed")
}
}

View file

@ -1 +0,0 @@
../../gradle

View file

@ -1 +0,0 @@
../../gradlew

View file

@ -1 +0,0 @@
../../gradlew.bat

View file

@ -1,104 +0,0 @@
/*
* 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.vulkan;
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
import de.staropensource.sosengine.base.classes.SubsystemClass;
import de.staropensource.sosengine.base.data.information.EngineInformation;
import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioningSystem;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.DependencyVector;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
import java.util.Set;
/**
* The main class of the Vulkan Graphics API.
*
* @since v1-alpha0
*/
@EngineSubsystem
@SuppressWarnings({ "JavadocDeclaration" })
public final class VulkanSubsystem extends SubsystemClass {
/**
* Contains the class instance.
*
* @since v1-alpha0
* -- GETTER --
* Returns the class instance.
*
* @return class instance unless the subsystem is uninitialized
* @since v1-alpha0
*/
@Getter
private static VulkanSubsystem instance = null;
/**
* Contains the {@link LoggerInstance} for this instance.
*
* @see LoggerInstance
* @since v1-alpha1
*/
private final @NotNull LoggerInstance logger = new LoggerInstance.Builder().setClazz(getClass()).setOrigin("ENGINE").build();
/**
* Constructs this subsystem.
*
* @since v1-alpha0
*/
public VulkanSubsystem() {
// Check if subsystem has already initialized
if (instance == null)
instance = this;
else {
instance.logger.crash("The subsystem tried to initialize twice");
}
}
/** {@inheritDoc} */
@Override
public @NotNull String getName() {
return "vulkan";
}
/** {@inheritDoc} */
@Override
public void initializeSubsystem() {
// Warn about instability
logger.warn("The Vulkan API is currently a stub and does not provide Vulkan as a Graphics API.\nIf you want to remove this message, remove the Vulkan subsystem from your dependencies.");
}
/** {@inheritDoc} */
@Override
public @NotNull DependencyVector getDependencyVector() {
Set<@NotNull String> dependencies = new HashSet<>();
dependencies.add("graphics");
dependencies.add("glfw");
return new DependencyVector.Builder()
.setIdentifier(getName())
.setVersioningSystem(StarOpenSourceVersioningSystem.class)
.setVersion(EngineInformation.getVersioningString())
.setDependencies(dependencies)
.build();
}
}

View file

@ -1,25 +0,0 @@
/*
* 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/>.
*/
/**
* Code of the Vulkan Graphics API.
*
* @since v1-alpha0
*/
package de.staropensource.sosengine.graphics.vulkan;

View file

@ -1,21 +0,0 @@
/**
* Defines the Vulkan Graphics API and {@code vulkan} subsystem, which allows for communicating with the graphics card via Vulkan.
*
* @since v1-alpha1
*/
module sosengine.graphics.vulkan {
// Dependencies
// -> Subsystems
requires transitive sosengine.base;
requires transitive sosengine.graphics;
// -> Libraries
requires transitive static lombok;
requires transitive org.jetbrains.annotations;
requires org.lwjgl.glfw;
// API access
exports de.staropensource.sosengine.graphics.vulkan;
// Reflection access
opens de.staropensource.sosengine.graphics.vulkan;
}

View file

@ -1,24 +0,0 @@
<!--
~ 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/>.
-->
<body>
<p>Welcome to the sos!engine API documentation!<br/>
You are currently in the documentation for the <b>vulkan</b> subsystem, allowing the Vulkan Graphics API to be used.</p>
<p>This subsystem does not provide any utility for your application, as it just implements interfaces and classes from the <b>graphics</b> subsystem.</p>
</body>

View file

@ -1 +0,0 @@
../../../../../src/main/javadoc/theme.css

View file

@ -22,8 +22,6 @@ rootProject.setName("sosengine")
include("base")
include("ansi")
include("slf4j-compat")
include("graphics")
include("graphics:glfw")
include("graphics:opengl")
include("graphics:vulkan")
include("windowing")
include("windowing:glfw")
include("testapp")

View file

@ -42,9 +42,7 @@ dependencies {
implementation(project(":base"))
implementation(project(":ansi"))
implementation(project(":slf4j-compat"))
implementation(project(":graphics"))
implementation(project(":graphics:vulkan"))
implementation(project(":graphics:opengl"))
implementation(project(":windowing"))
}
// Fix delombok task

View file

@ -29,11 +29,11 @@ import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.base.utility.DependencyResolver;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.base.utility.parser.StackTraceParser;
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.events.InputEvent;
import de.staropensource.sosengine.graphics.types.input.Key;
import de.staropensource.sosengine.graphics.types.input.KeyState;
import de.staropensource.sosengine.windowing.WindowingSubsystem;
import de.staropensource.sosengine.windowing.classes.Window;
import de.staropensource.sosengine.windowing.events.InputEvent;
import de.staropensource.sosengine.windowing.types.input.Key;
import de.staropensource.sosengine.windowing.types.input.KeyState;
import lombok.Getter;
import lombok.SneakyThrows;
import org.jetbrains.annotations.NotNull;
@ -180,9 +180,9 @@ public final class Main {
}
logger.warn("Test resolution succeeded");
// Choose Graphics API to use
if (!GraphicsSubsystem.getInstance().setGraphicsApi())
logger.crash("No Graphics API is compatible");
// Choose windowing API to use
if (!WindowingSubsystem.getInstance().setApi())
logger.crash("No windowing API is compatible");
// Create window
Window window;
@ -198,7 +198,7 @@ public final class Main {
return;
}
LinkedHashMap<@NotNull Window, @NotNull Throwable> renderLoopFailures = GraphicsSubsystem
LinkedHashMap<@NotNull Window, @NotNull Throwable> renderLoopFailures = WindowingSubsystem
.getInstance()
.getApi()
.getManagement()

View file

@ -8,9 +8,7 @@ open module sosengine.testapp {
// Dependencies
// -> Subsystems
requires sosengine.base;
requires sosengine.graphics;
requires sosengine.graphics.opengl;
requires sosengine.graphics.vulkan;
requires sosengine.windowing;
requires sosengine.slf4j_compat;
// -> Libraries
requires static lombok;

2
windowing/README.md Normal file
View file

@ -0,0 +1,2 @@
# The `windowing` subsystem
This subsystem provides abstract APIs for creating and managing windows and monitors, which can then be implemented by windowing APIs and used by applications and games.

View file

@ -79,7 +79,7 @@ dependencies {
// -> Project <-
implementation(project(":base"))
implementation(project(":graphics"))
implementation(project(":windowing"))
}
// Fix delombok task

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw;
package de.staropensource.sosengine.windowing.glfw;
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
import de.staropensource.sosengine.base.classes.SubsystemClass;
@ -26,9 +26,9 @@ import de.staropensource.sosengine.base.data.versioning.StarOpenSourceVersioning
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.DependencyVector;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.graphics.events.GraphicsErrorEvent;
import de.staropensource.sosengine.graphics.exceptions.NotOnMainThreadException;
import de.staropensource.sosengine.graphics.glfw.exceptions.GlfwInitializationException;
import de.staropensource.sosengine.windowing.events.WindowingErrorEvent;
import de.staropensource.sosengine.windowing.exceptions.NotOnMainThreadException;
import de.staropensource.sosengine.windowing.glfw.exceptions.GlfwInitializationException;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFWErrorCallback;
@ -79,7 +79,7 @@ public final class GlfwSubsystem extends SubsystemClass {
/** {@inheritDoc} */
@Override
public void invoke(int error, long description) {
new GraphicsErrorEvent().callEvent(description + " (" + error + ")");
new WindowingErrorEvent().callEvent(description + " (" + error + ")");
}
});
@ -113,7 +113,7 @@ public final class GlfwSubsystem extends SubsystemClass {
@Override
public @NotNull DependencyVector getDependencyVector() {
Set<@NotNull String> dependencies = new HashSet<>();
dependencies.add("graphics");
dependencies.add("windowing");
return new DependencyVector.Builder()
.setIdentifier(getName())

View file

@ -17,11 +17,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw;
package de.staropensource.sosengine.windowing.glfw;
import de.staropensource.sosengine.base.classes.Configuration;
import de.staropensource.sosengine.base.utility.PropertiesReader;
import de.staropensource.sosengine.graphics.glfw.types.GlfwPlatform;
import de.staropensource.sosengine.windowing.glfw.types.GlfwPlatform;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -58,7 +58,7 @@ public final class GlfwSubsystemConfiguration extends Configuration {
* @since v1-alpha0
*/
@Getter
private final @NotNull String group = "sosengine.graphics.glfw.";
private final @NotNull String group = "sosengine.windowing.glfw.";
/**
* Contains the platform GLFW will try to initialize with.

View file

@ -17,13 +17,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.callbacks;
package de.staropensource.sosengine.windowing.glfw.callbacks;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.events.InputEvent;
import de.staropensource.sosengine.graphics.glfw.classes.WindowCallback;
import de.staropensource.sosengine.graphics.types.input.Key;
import de.staropensource.sosengine.graphics.types.input.KeyState;
import de.staropensource.sosengine.windowing.classes.Window;
import de.staropensource.sosengine.windowing.events.InputEvent;
import de.staropensource.sosengine.windowing.glfw.classes.WindowCallback;
import de.staropensource.sosengine.windowing.types.input.Key;
import de.staropensource.sosengine.windowing.types.input.KeyState;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFWKeyCallbackI;

View file

@ -17,13 +17,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.callbacks;
package de.staropensource.sosengine.windowing.glfw.callbacks;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.events.InputEvent;
import de.staropensource.sosengine.graphics.glfw.classes.WindowCallback;
import de.staropensource.sosengine.graphics.types.input.Key;
import de.staropensource.sosengine.graphics.types.input.KeyState;
import de.staropensource.sosengine.windowing.classes.Window;
import de.staropensource.sosengine.windowing.events.InputEvent;
import de.staropensource.sosengine.windowing.glfw.classes.WindowCallback;
import de.staropensource.sosengine.windowing.types.input.Key;
import de.staropensource.sosengine.windowing.types.input.KeyState;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFWMouseButtonCallbackI;

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha2
*/
package de.staropensource.sosengine.graphics.glfw.callbacks;
package de.staropensource.sosengine.windowing.glfw.callbacks;

View file

@ -17,12 +17,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.classes;
package de.staropensource.sosengine.windowing.glfw.classes;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.graphics.classes.Monitor;
import de.staropensource.sosengine.graphics.classes.api.ApiInternalClass;
import de.staropensource.sosengine.graphics.exceptions.NoMonitorsFoundException;
import de.staropensource.sosengine.windowing.classes.Monitor;
import de.staropensource.sosengine.windowing.classes.api.ApiInternalClass;
import de.staropensource.sosengine.windowing.exceptions.NoMonitorsFoundException;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.PointerBuffer;
@ -33,7 +33,7 @@ import java.util.LinkedHashSet;
import static org.lwjgl.glfw.GLFW.glfwGetMonitors;
/**
* The internal API class for GLFW-powered Graphics APIs.
* The internal API class for GLFW-powered windowing APIs.
*
* @since v1-alpha2
*/

View file

@ -17,13 +17,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.classes;
package de.staropensource.sosengine.windowing.glfw.classes;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.graphics.classes.api.ApiManagementClass;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.exceptions.NotOnMainThreadException;
import de.staropensource.sosengine.windowing.classes.api.ApiManagementClass;
import de.staropensource.sosengine.windowing.classes.Window;
import de.staropensource.sosengine.windowing.exceptions.NotOnMainThreadException;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
@ -32,7 +32,7 @@ import java.util.*;
import static org.lwjgl.glfw.GLFW.*;
/**
* The abstract management class for GLFW-powered Graphics APIs.
* The abstract management class for GLFW-powered windowing APIs.
*
* @since v1-alpha2
*/

View file

@ -17,11 +17,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.classes;
package de.staropensource.sosengine.windowing.glfw.classes;
import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.graphics.classes.Monitor;
import de.staropensource.sosengine.graphics.exceptions.InvalidMonitorException;
import de.staropensource.sosengine.windowing.classes.Monitor;
import de.staropensource.sosengine.windowing.exceptions.InvalidMonitorException;
import lombok.SneakyThrows;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFWVidMode;

View file

@ -17,23 +17,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.classes;
package de.staropensource.sosengine.windowing.glfw.classes;
import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException;
import de.staropensource.sosengine.base.types.Tristate;
import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.graphics.GraphicsSubsystemConfiguration;
import de.staropensource.sosengine.graphics.classes.Monitor;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.events.GraphicsApiErrorEvent;
import de.staropensource.sosengine.graphics.events.InputEvent;
import de.staropensource.sosengine.graphics.glfw.callbacks.KeyCallback;
import de.staropensource.sosengine.graphics.glfw.callbacks.MouseButtonCallback;
import de.staropensource.sosengine.graphics.exceptions.NotOnMainThreadException;
import de.staropensource.sosengine.graphics.exceptions.WindowCreationFailureException;
import de.staropensource.sosengine.graphics.types.window.VsyncMode;
import de.staropensource.sosengine.graphics.types.window.WindowMode;
import de.staropensource.sosengine.windowing.WindowingSubsystemConfiguration;
import de.staropensource.sosengine.windowing.classes.Monitor;
import de.staropensource.sosengine.windowing.classes.Window;
import de.staropensource.sosengine.windowing.events.RenderingErrorEvent;
import de.staropensource.sosengine.windowing.events.InputEvent;
import de.staropensource.sosengine.windowing.glfw.callbacks.KeyCallback;
import de.staropensource.sosengine.windowing.glfw.callbacks.MouseButtonCallback;
import de.staropensource.sosengine.windowing.exceptions.NotOnMainThreadException;
import de.staropensource.sosengine.windowing.exceptions.WindowCreationFailureException;
import de.staropensource.sosengine.windowing.types.window.VsyncMode;
import de.staropensource.sosengine.windowing.types.window.WindowMode;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFWKeyCallback;
@ -47,7 +47,7 @@ import java.util.Objects;
import static org.lwjgl.glfw.GLFW.*;
/**
* Abstract class for implementing GLFW-powered windows in a Graphics API.
* Abstract class for implementing GLFW-powered windows in a windowing API.
*
* @since v1-alpha2
*/
@ -98,7 +98,7 @@ public abstract class GlfwWindow extends Window {
* @param onTop on top flag
* @param transparent transparency flag
* @param rendering rendering flag
* @throws UnexpectedThrowableException stuff thrown by the {@link #initializeWindow()} and {@link #render()} methods of the implementing Graphics API
* @throws UnexpectedThrowableException stuff thrown by the {@link #initializeWindow()} and {@link #render()} methods of the implementing windowing API
* @since v1-alpha2
*/
protected GlfwWindow(@NotNull String name, @NotNull String title, @NotNull Vec2i size, @NotNull Vec2i minimumSize, @NotNull Vec2i maximumSize, @NotNull Vec2i position, @NotNull WindowMode windowMode, @NotNull Monitor monitor, boolean resizable, boolean borderless, boolean focusable, boolean onTop, boolean transparent, boolean rendering) throws UnexpectedThrowableException {
@ -113,7 +113,7 @@ public abstract class GlfwWindow extends Window {
}
/**
* Allows the Graphics API to initialize the window.
* Allows the windowing API to initialize the window.
*
* @throws Throwable throwable
* @since v1-alpha2
@ -152,7 +152,7 @@ public abstract class GlfwWindow extends Window {
// Create window
long identifier = glfwCreateWindow(getSize().getX(), getSize().getY(), getTitle(), MemoryUtil.NULL, MemoryUtil.NULL);
if (identifier == MemoryUtil.NULL) {
new GraphicsApiErrorEvent().callEvent("Unable to create window: Identifier is null");
new RenderingErrorEvent().callEvent("Unable to create window: Identifier is null");
throw new WindowCreationFailureException();
}
@ -164,7 +164,7 @@ public abstract class GlfwWindow extends Window {
ownContext();
// Set swap interval based on V-Sync mode setting
glfwSwapInterval(GraphicsSubsystemConfiguration.getInstance().getVsyncMode() == VsyncMode.ON ? 1 : 0);
glfwSwapInterval(WindowingSubsystemConfiguration.getInstance().getVsyncMode() == VsyncMode.ON ? 1 : 0);
// Create callbacks
keyCallback = GLFWKeyCallback.create(new KeyCallback(this));
@ -182,7 +182,7 @@ public abstract class GlfwWindow extends Window {
}
/**
* Allows the Graphics API to set custom
* Allows the windowing API to set custom
* window hints during window creation.
*
* @since v1-alpha2
@ -270,12 +270,12 @@ public abstract class GlfwWindow extends Window {
super.setOnTop(Miscellaneous.getBooleanizedInteger(glfwGetWindowAttrib(identifierLong, GLFW_FLOATING)));
super.setTransparent(Miscellaneous.getBooleanizedInteger(glfwGetWindowAttrib(identifierLong, GLFW_TRANSPARENT_FRAMEBUFFER)));
// Make Graphics API update it's state
// Make windowing API update it's state
updateGlfwState();
}
/**
* Allows the Graphics API to update it's state.
* Allows the windowing API to update it's state.
*
* @throws Throwable throwable
* @since v1-alpha2

View file

@ -17,9 +17,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.classes;
package de.staropensource.sosengine.windowing.glfw.classes;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.windowing.classes.Window;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;

View file

@ -20,6 +20,6 @@
/**
* Interfaces and abstract classes which can be used for implementing classes.
* <p>
* These are not to be confused with data types. See {@link de.staropensource.sosengine.graphics.glfw.types}.
* These are not to be confused with data types. See {@link de.staropensource.sosengine.windowing.glfw.types}.
*/
package de.staropensource.sosengine.graphics.glfw.classes;
package de.staropensource.sosengine.windowing.glfw.classes;

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.exceptions;
package de.staropensource.sosengine.windowing.glfw.exceptions;
/**
* Thrown when GLFW fails to initialize.

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha2
*/
package de.staropensource.sosengine.graphics.glfw.exceptions;
package de.staropensource.sosengine.windowing.glfw.exceptions;

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha2
*/
package de.staropensource.sosengine.graphics.glfw;
package de.staropensource.sosengine.windowing.glfw;

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.glfw.types;
package de.staropensource.sosengine.windowing.glfw.types;
/**
* Contains all available platforms which GLFW can be initialized with.

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha2
*/
package de.staropensource.sosengine.graphics.glfw.types;
package de.staropensource.sosengine.windowing.glfw.types;

View file

@ -0,0 +1,29 @@
import de.staropensource.sosengine.windowing.classes.Window;
/**
* The {@code glfw} subsystem and windowing API, which makes it
* possible to create {@link Window} using the GLFW library.
*
* @since v1-alpha4
*/
module sosengine.windowing.glfw {
// Dependencies
// -> Subsystems
requires transitive sosengine.base;
requires transitive sosengine.windowing;
// -> Libraries
requires transitive static lombok;
requires transitive org.jetbrains.annotations;
requires org.lwjgl;
requires org.lwjgl.glfw;
// API access
exports de.staropensource.sosengine.windowing.glfw;
exports de.staropensource.sosengine.windowing.glfw.classes;
exports de.staropensource.sosengine.windowing.glfw.exceptions;
// Reflection access
opens de.staropensource.sosengine.windowing.glfw;
opens de.staropensource.sosengine.windowing.glfw.classes;
opens de.staropensource.sosengine.windowing.glfw.exceptions;
}

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics;
package de.staropensource.sosengine.windowing;
import de.staropensource.sosengine.base.annotations.EngineSubsystem;
import de.staropensource.sosengine.base.annotations.EventListener;
@ -30,11 +30,11 @@ import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.DependencyVector;
import de.staropensource.sosengine.base.utility.ListFormatter;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.graphics.classes.api.ApiClass;
import de.staropensource.sosengine.graphics.events.GraphicsApiErrorEvent;
import de.staropensource.sosengine.graphics.events.GraphicsApiShutdownEvent;
import de.staropensource.sosengine.graphics.events.GraphicsErrorEvent;
import de.staropensource.sosengine.graphics.events.InputEvent;
import de.staropensource.sosengine.windowing.classes.api.ApiClass;
import de.staropensource.sosengine.windowing.events.RenderingErrorEvent;
import de.staropensource.sosengine.windowing.events.WindowingShutdownEvent;
import de.staropensource.sosengine.windowing.events.WindowingErrorEvent;
import de.staropensource.sosengine.windowing.events.InputEvent;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
@ -44,13 +44,13 @@ import java.util.List;
import java.util.Map;
/**
* The main class of the Graphics subsystem.
* The main class of the windowing subsystem.
*
* @since v1-alpha0
*/
@EngineSubsystem
@SuppressWarnings({ "JavadocDeclaration" })
public final class GraphicsSubsystem extends SubsystemClass {
public final class WindowingSubsystem extends SubsystemClass {
/**
* Contains the class instance.
*
@ -62,17 +62,17 @@ public final class GraphicsSubsystem extends SubsystemClass {
* @since v1-alpha0
*/
@Getter
private static GraphicsSubsystem instance = null;
private static WindowingSubsystem instance = null;
/**
* Contains a list of all registered Graphics APIs.
* Contains a list of all registered windowing APIs.
*
* @see ApiClass
* @since v1-alpha0
* -- GETTER --
* Returns a list of all registered Graphics APIs.
* Returns a list of all registered windowing APIs.
*
* @return list of all registered Graphics APIs
* @return list of all registered windowing APIs
* @see ApiClass
* @since v1-alpha0
*/
@ -80,14 +80,14 @@ public final class GraphicsSubsystem extends SubsystemClass {
private final @NotNull Map<@NotNull String, @NotNull ApiClass> registeredApis = new HashMap<>();
/**
* Contains a reference to the active Graphics API main class.
* Contains a reference to the active windowing API main class.
*
* @see ApiClass
* @since v1-alpha0
* -- GETTER --
* Returns a reference to the active Graphics API main class.
* Returns a reference to the active windowing API main class.
*
* @return Graphics API main class reference
* @return windowing API main class reference
* @see ApiClass
* @since v1-alpha0
*/
@ -99,7 +99,7 @@ public final class GraphicsSubsystem extends SubsystemClass {
*
* @since v1-alpha0
*/
public GraphicsSubsystem() {
public WindowingSubsystem() {
// Only allow one instance
if (instance == null)
instance = this;
@ -110,31 +110,31 @@ public final class GraphicsSubsystem extends SubsystemClass {
/** {@inheritDoc} */
@Override
public @NotNull String getName() {
return "graphics";
return "windowing";
}
/** {@inheritDoc} */
@Override
public void initializeSubsystem() {
// Initialize GraphicsSubsystemConfiguration and load it
new GraphicsSubsystemConfiguration().loadConfiguration();
// Initialize WindowingSubsystemConfiguration and load it
new WindowingSubsystemConfiguration().loadConfiguration();
// Precompute event listeners
cacheEvents();
// Warn about subsystem and API instability
logger.warn("The graphics subsystem is experimental. Subsystem and API stability are not guaranteed.");
logger.warn("The windowing subsystem is experimental. Subsystem and API stability are not guaranteed.");
}
/**
* Caches all graphics subsystem events.
* Caches all windowing subsystem events.
*
* @since v1-alpha0
*/
public static void cacheEvents() {
EventHelper.cacheEvent(GraphicsApiErrorEvent.class);
EventHelper.cacheEvent(GraphicsApiShutdownEvent.class);
EventHelper.cacheEvent(GraphicsErrorEvent.class);
EventHelper.cacheEvent(RenderingErrorEvent.class);
EventHelper.cacheEvent(WindowingShutdownEvent.class);
EventHelper.cacheEvent(WindowingErrorEvent.class);
EventHelper.cacheEvent(InputEvent.class);
}
@ -142,7 +142,7 @@ public final class GraphicsSubsystem extends SubsystemClass {
@Override
public @NotNull DependencyVector getDependencyVector() {
return new DependencyVector.Builder()
.setIdentifier("graphics")
.setIdentifier(getName())
.setVersioningSystem(StarOpenSourceVersioningSystem.class)
.setVersion(EngineInformation.getVersioningString())
.build();
@ -160,7 +160,7 @@ public final class GraphicsSubsystem extends SubsystemClass {
logger.verb("Shutting down");
long shutdownTime = Miscellaneous.measureExecutionTime(() -> {
new GraphicsApiShutdownEvent().callEvent();
new WindowingShutdownEvent().callEvent();
if (instance.api != null)
instance.api.shutdownApi();
@ -170,13 +170,13 @@ public final class GraphicsSubsystem extends SubsystemClass {
}
/**
* Registers a Graphics API.
* Registers a windowing API.
*
* @param mainClass main class of the Graphics API
* @param mainClass main class of the windowing API
* @since v1-alpha0
*/
public void registerGraphicsApi(@NotNull ApiClass mainClass) {
logger.verb("Registering Graphics API " + mainClass.getApiName() + " (" + mainClass.getClass().getName() + ")");
public void registerApi(@NotNull ApiClass mainClass) {
logger.verb("Registering windowing API " + mainClass.getApiName() + " (" + mainClass.getClass().getName() + ")");
Object[] output = Miscellaneous.getMapValues(registeredApis, mainClass).toArray();
@ -185,14 +185,14 @@ public final class GraphicsSubsystem extends SubsystemClass {
}
/**
* Chooses a Graphics API to use automatically based on hardware support.
* Chooses a windowing API to use automatically based on hardware support.
*
* @return if a compatible Graphics API has been chosen
* @see #setGraphicsApi(String)
* @return if a compatible windowing API has been chosen
* @see #setApi(String)
* @since v1-alpha0
*/
public boolean setGraphicsApi() {
logger.verb("Choosing a compatible Graphics API");
public boolean setApi() {
logger.verb("Choosing a compatible windowing API");
List<@NotNull String> compatibleApis = new ArrayList<>();
@ -205,7 +205,7 @@ public final class GraphicsSubsystem extends SubsystemClass {
logger.diag(apiName + " is incompatible with this system");
if (compatibleApis.isEmpty()) {
logger.error("No compatible Graphics API was found");
logger.error("No compatible windowing API was found");
return false;
} else if (compatibleApis.size() == 1)
logger.diag("Compatible is " + compatibleApis.getFirst());
@ -215,10 +215,10 @@ public final class GraphicsSubsystem extends SubsystemClass {
// Choose last item in list.
api = registeredApis.get(compatibleApis.getLast());
try {
logger.diag("Initializing Graphics API");
logger.diag("Initialized Graphics API in " + Miscellaneous.measureExecutionTime(() -> api.initializeApi()) + "ms");
logger.diag("Initializing windowing API");
logger.diag("Initialized windowing API in " + Miscellaneous.measureExecutionTime(() -> api.initializeApi()) + "ms");
} catch (Throwable throwable) {
logger.crash("Graphics API failed to initialize", throwable, true);
logger.crash("windowing API failed to initialize", throwable, true);
throw throwable;
}
@ -226,27 +226,27 @@ public final class GraphicsSubsystem extends SubsystemClass {
}
/**
* Sets the Graphics API to use.
* Sets the windowing API to use.
*
* @param name name of the Graphics API
* @return if the Graphics API has been found
* @see #setGraphicsApi()
* @param name name of the windowing API
* @return if the windowing API has been found
* @see #setApi()
* @since v1-alpha0
*/
public boolean setGraphicsApi(@NotNull String name) {
public boolean setApi(@NotNull String name) {
if (!registeredApis.containsKey(name))
return false;
logger.verb("Setting Graphics API " + name);
logger.verb("Setting windowing API " + name);
if (api == null)
api = registeredApis.get(name);
else
logger.crash("Unable to set Graphics API: Graphics API " + api.getApiName() + " already registered");
logger.crash("Unable to set windowing API: windowing API " + api.getApiName() + " already registered");
// Initialize API
logger.diag("Initializing Graphics API " + api.getApiName());
logger.diag("Initialized Graphics API " + api.getApiName() + " in " + Miscellaneous.measureExecutionTime(() -> api.initializeApi()) + "ms");
logger.diag("Initializing windowing API " + api.getApiName());
logger.diag("Initialized windowing API " + api.getApiName() + " in " + Miscellaneous.measureExecutionTime(() -> api.initializeApi()) + "ms");
return true;
}

View file

@ -17,24 +17,25 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics;
package de.staropensource.sosengine.windowing;
import de.staropensource.sosengine.base.classes.Configuration;
import de.staropensource.sosengine.base.utility.PropertiesReader;
import de.staropensource.sosengine.graphics.events.GraphicsErrorEvent;
import de.staropensource.sosengine.graphics.types.window.VsyncMode;
import de.staropensource.sosengine.windowing.events.RenderingErrorEvent;
import de.staropensource.sosengine.windowing.events.WindowingErrorEvent;
import de.staropensource.sosengine.windowing.types.window.VsyncMode;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Provides the Graphics subsystem configuration.
* Provides the windowing subsystem configuration.
*
* @since v1-alpha0
*/
@Getter
@SuppressWarnings({ "JavadocDeclaration" })
public final class GraphicsSubsystemConfiguration extends Configuration {
public final class WindowingSubsystemConfiguration extends Configuration {
/**
* Contains the class instance.
*
@ -42,11 +43,11 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
* -- GETTER --
* Returns the class instance.
*
* @return class instance unless {@link GraphicsSubsystem} is uninitialized
* @return class instance unless {@link WindowingSubsystem} is uninitialized
* @since v1-alpha0
*/
@Getter
private static GraphicsSubsystemConfiguration instance;
private static WindowingSubsystemConfiguration instance;
/**
* Defines the group every property must start with to be recognized as a subsystem configuration setting.
@ -59,10 +60,10 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
* @since v1-alpha0
*/
@Getter
public final @NotNull String group = "sosengine.graphics.";
public final @NotNull String group = "sosengine.windowing.";
/**
* If enabled, allows for unintentional behaviour and excess logging.<br/>
* If enabled, allows for unintentional behaviour and excess logging.
* Unless you want to debug or work on a sensitive part of the subsystem, don't enable this!
*
* @since v1-alpha0
@ -70,7 +71,7 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
* Gets the value for {@link #debug}.
*
* @return variable value
* @see GraphicsSubsystemConfiguration#debug
* @see WindowingSubsystemConfiguration#debug
* @since v1-alpha0
*/
private boolean debug;
@ -83,7 +84,7 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
* Gets the value for {@link #debugInput}.
*
* @return variable value
* @see GraphicsSubsystemConfiguration#debugInput
* @see WindowingSubsystemConfiguration#debugInput
* @since v1-alpha2
*/
private boolean debugInput;
@ -103,18 +104,32 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
private boolean debugFrames;
/**
* If enabled, graphical errors thrown by GLFW will be printed to the log by the subsystem.
* Causes windowing errors will be logged, if enabled.
*
* @see GraphicsErrorEvent
* @since v1-alpha0
* @see WindowingErrorEvent
* @since v1-alpha4
* -- GETTER --
* Gets the value for {@link #errorGraphicsError}.
* Gets the value for {@link #errorWindowingFailure}.
*
* @return variable value
* @see GraphicsSubsystemConfiguration#errorGraphicsError
* @since v1-alpha0
* @see WindowingSubsystemConfiguration#errorWindowingFailure
* @since v1-alpha4
*/
private boolean errorGraphicsError;
private boolean errorWindowingFailure;
/**
* Causes rendering errors will be logged, if enabled.
*
* @see RenderingErrorEvent
* @since v1-alpha4
* -- GETTER --
* Gets the value for {@link #errorRenderingFailure}.
*
* @return variable value
* @see WindowingSubsystemConfiguration#errorRenderingFailure
* @since v1-alpha4
*/
private boolean errorRenderingFailure;
/**
* Contains how many frames can be rendered per second.
@ -152,10 +167,10 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
/**
* Constructs this class.
*
* @see GraphicsSubsystem
* @see WindowingSubsystem
* @since v1-alpha0
*/
public GraphicsSubsystemConfiguration() {
public WindowingSubsystemConfiguration() {
super("ENGINE"); // TODO Wait for flexible constructor bodies (JEP 482) to be implemented into the JVM as a stable feature. We don't want to use preview features in production code.
// Only allow one instance
@ -175,7 +190,8 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
case "debugInput" -> debugInput = parser.getBoolean(group + property);
case "debugFrames" -> debugFrames = parser.getBoolean(group + property);
case "errorGraphicsError" -> errorGraphicsError = parser.getBoolean(group + property);
case "errorWindowingFailure" -> errorWindowingFailure = parser.getBoolean(group + property);
case "errorRenderingFailure" -> errorRenderingFailure = parser.getBoolean(group + property);
case "vsyncMode" -> {
try {
@ -205,7 +221,8 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
debugInput = false;
debugFrames = false;
errorGraphicsError = true;
errorWindowingFailure = true;
errorRenderingFailure = true;
vsyncMode = VsyncMode.ON;
maximumFramesPerSecond = 60;
@ -219,7 +236,8 @@ public final class GraphicsSubsystemConfiguration extends Configuration {
case "debugInput" -> { return debugInput; }
case "debugFrames" -> { return debugFrames; }
case "errorGraphicsError" -> { return errorGraphicsError; }
case "errorWindowingFailure" -> { return errorWindowingFailure; }
case "errorRenderingFailure" -> { return errorRenderingFailure; }
case "vsyncMode" -> { return vsyncMode; }
case "maximumFramesPerSecond" -> { return maximumFramesPerSecond; }

View file

@ -17,13 +17,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.classes;
package de.staropensource.sosengine.windowing.classes;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
import de.staropensource.sosengine.graphics.exceptions.InvalidMonitorException;
import de.staropensource.sosengine.graphics.exceptions.NoMonitorsFoundException;
import de.staropensource.sosengine.windowing.WindowingSubsystem;
import de.staropensource.sosengine.windowing.exceptions.InvalidMonitorException;
import de.staropensource.sosengine.windowing.exceptions.NoMonitorsFoundException;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@ -33,7 +33,7 @@ import java.util.LinkedHashSet;
import java.util.UUID;
/**
* Abstract class for implementing monitors in a Graphics API.
* Abstract class for implementing monitors in a windowing API.
* <p>
* Note that monitors stop working unannounced when disconnected,
* call {@link #isConnected()} before using to avoid unexpected behaviour.
@ -77,20 +77,20 @@ public abstract class Monitor {
/**
* Contains the monitor identifier.
* <p>
* This identifier is used by the Graphics API to refer to a monitor and may change during runtime.
* This identifier is used by the windowing API to refer to a monitor and may change during runtime.
*
* @since v1-alpha1
* -- GETTER --
* Returns the monitor identifier.
* <p>
* This identifier is used by the Graphics API to refer to a monitor and may change during runtime.
* This identifier is used by the windowing API to refer to a monitor and may change during runtime.
*
* @return monitor identifier
* @since v1-alpha2
* -- SETTER --
* Sets the monitor identifier.
* <p>
* This identifier is used by the Graphics API to refer to a monitor and may change during runtime.
* This identifier is used by the windowing API to refer to a monitor and may change during runtime.
*
* @param identifier new monitor identifier
* @since v1-alpha2
@ -115,7 +115,7 @@ public abstract class Monitor {
* @since v1-alpha2
*/
public static @NotNull LinkedHashSet<@NotNull Monitor> getMonitors() throws NoMonitorsFoundException {
return GraphicsSubsystem.getInstance().getApi().getInternalApi().getMonitors();
return WindowingSubsystem.getInstance().getApi().getInternalApi().getMonitors();
}
/**

View file

@ -17,14 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.classes;
package de.staropensource.sosengine.windowing.classes;
import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.Tristate;
import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
import de.staropensource.sosengine.graphics.types.window.WindowMode;
import de.staropensource.sosengine.windowing.WindowingSubsystem;
import de.staropensource.sosengine.windowing.types.window.WindowMode;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@ -36,7 +36,7 @@ import java.util.Set;
import java.util.UUID;
/**
* Abstract class for implementing windows in a Graphics API.
* Abstract class for implementing windows in a windowing API.
* <p>
* Note that many window properties may be overridden by any
* window manager or compositor. Make sure to poll for changes
@ -107,20 +107,20 @@ public abstract class Window implements AutoCloseable {
/**
* Contains the window identifier.
* <p>
* This identifier is used by the Graphics API to refer to a window and may change during runtime.
* This identifier is used by the windowing API to refer to a window and may change during runtime.
*
* @since v1-alpha1
* -- GETTER --
* Returns the window identifier.
* <p>
* This identifier is used by the Graphics API to refer to a window and may change during runtime.
* This identifier is used by the windowing API to refer to a window and may change during runtime.
*
* @return window identifier
* @since v1-alpha2
* -- SETTER --
* Sets the window identifier.
* <p>
* This identifier is used by the Graphics API to refer to a window and may change during runtime.
* This identifier is used by the windowing API to refer to a window and may change during runtime.
*
* @param identifier new window identifier
* @since v1-alpha2
@ -417,14 +417,14 @@ public abstract class Window implements AutoCloseable {
/**
* Enables or disables transparency support for this window.
* <p>
* Availability depends on the Graphics API, compositor or
* Availability depends on the windowing API, compositor or
* window manager and potentially system settings.
*
* @since v1-alpha2
* -- GETTER --
* Returns if the window can be transparent.
* <p>
* Availability depends on the Graphics API, compositor or
* Availability depends on the windowing API, compositor or
* window manager and potentially system settings.
*
* @return transparency flag state
@ -432,7 +432,7 @@ public abstract class Window implements AutoCloseable {
* -- SETTER --
* Sets if the window can be transparent.
* <p>
* Availability depends on the Graphics API, compositor or
* Availability depends on the windowing API, compositor or
* window manager and potentially system settings.
*
* @param transparent new transparency flag state
@ -486,7 +486,7 @@ public abstract class Window implements AutoCloseable {
* @param onTop on top flag
* @param transparent transparency flag
* @param rendering rendering flag
* @throws UnexpectedThrowableException stuff thrown by the {@link #initializeWindow()} and {@link #render()} methods of the implementing Graphics API
* @throws UnexpectedThrowableException stuff thrown by the {@link #initializeWindow()} and {@link #render()} methods of the implementing windowing API
* @since v1-alpha2
*/
protected Window(@NotNull String name, @NotNull String title, @NotNull Vec2i size, @NotNull Vec2i minimumSize, @NotNull Vec2i maximumSize, @NotNull Vec2i position, @NotNull WindowMode windowMode, @NotNull Monitor monitor, boolean resizable, boolean borderless, boolean focusable, boolean onTop, boolean transparent, boolean rendering) throws UnexpectedThrowableException {
@ -511,7 +511,7 @@ public abstract class Window implements AutoCloseable {
logger.diag("Creating new window with properties: uniqueIdentifier=" + uniqueIdentifier + " name=\"" + name + "\" title=\"" + title + "\" size=" + size + " minimumSize=" + minimumSize + " maximumSize=" + maximumSize + " position=" + position + " windowMode=" + windowMode + " monitor=" + monitor.getUniqueIdentifier() + " (" + monitor.getName() + ") resizable=" + resizable + " borderless=" + borderless + " focusable=" + focusable + " onTop=" + onTop + " transparent=" + transparent + " rendering=" + rendering);
try {
// Allow Graphics API to initialize window
// Allow windowing API to initialize window
initializeWindow();
// Update state and render first image
@ -526,7 +526,7 @@ public abstract class Window implements AutoCloseable {
}
/**
* Allows the Graphics API to initialize the window.
* Allows the windowing API to initialize the window.
* <p>
* NEVER place any code in the constructor. Instead, write
* API-specific window initialization code in here
@ -791,7 +791,7 @@ public abstract class Window implements AutoCloseable {
// Create new Window instance
try {
return GraphicsSubsystem.getInstance().getApi().getInternalApi().getWindowClass()
return WindowingSubsystem.getInstance().getApi().getInternalApi().getWindowClass()
.getDeclaredConstructor(String.class, String.class, Vec2i.class, Vec2i.class, Vec2i.class, Vec2i.class, WindowMode.class, Monitor.class, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE, Boolean.TYPE)
.newInstance(name, title, size, minimumSize, maximumSize, position, windowMode, monitor, resizableBoolean, borderlessBoolean, focusableBoolean, onTopBoolean, transparentBoolean, renderingBoolean);
} catch (Throwable throwable) {

View file

@ -17,16 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.classes.api;
package de.staropensource.sosengine.windowing.classes.api;
import de.staropensource.sosengine.base.Engine;
import de.staropensource.sosengine.base.annotations.EventListener;
import de.staropensource.sosengine.base.classes.SubsystemClass;
import de.staropensource.sosengine.graphics.events.GraphicsErrorEvent;
import org.jetbrains.annotations.NotNull;
/**
* The interface for Graphics API main classes.
* The interface for windowing API main classes.
*
* @since v1-alpha0
*/
@ -39,14 +37,14 @@ public abstract class ApiClass extends SubsystemClass {
public ApiClass() {}
/**
* Initializes the Graphics API.
* Initializes the windowing API.
*
* @since v1-alpha0
*/
public abstract void initializeApi();
/**
* Shuts the Graphics API down.
* Shuts the windowing API down.
* <p>
* Called when the engine shuts down.
*
@ -57,15 +55,15 @@ public abstract class ApiClass extends SubsystemClass {
public abstract void shutdownApi();
/**
* Returns the name of the Graphics API.
* Returns the name of the windowing API.
*
* @return Graphics API name
* @return windowing API name
* @since v1-alpha0
*/
public abstract String getApiName();
/**
* Returns the Graphics API's internal API access class.
* Returns the windowing API's internal API access class.
*
* @return a {@link ApiInternalClass}
* @see ApiInternalClass
@ -75,7 +73,7 @@ public abstract class ApiClass extends SubsystemClass {
public abstract ApiInternalClass getInternalApi();
/**
* Returns the Graphics API's management class.
* Returns the windowing API's management class.
*
* @return a {@link ApiManagementClass}
* @see ApiManagementClass
@ -85,20 +83,10 @@ public abstract class ApiClass extends SubsystemClass {
public abstract ApiManagementClass getManagement();
/**
* Checks if the Graphics API is compatible with the underlying hardware.
* Checks if the windowing API is compatible with the underlying hardware.
*
* @return if the Graphics API is compatible
* @return if the windowing API is compatible
* @since v1-alpha0
*/
public abstract boolean isCompatible();
/**
* Called when a graphics error occurs.
*
* @param error graphics error
* @since v1-alpha0
*/
@EventListener(event = GraphicsErrorEvent.class)
@SuppressWarnings({ "unused" })
public static void onGraphicsError(String error) {}
}

View file

@ -17,23 +17,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.classes.api;
package de.staropensource.sosengine.windowing.classes.api;
import de.staropensource.sosengine.graphics.classes.Monitor;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.exceptions.NoMonitorsFoundException;
import de.staropensource.sosengine.windowing.classes.Monitor;
import de.staropensource.sosengine.windowing.classes.Window;
import de.staropensource.sosengine.windowing.exceptions.NoMonitorsFoundException;
import org.jetbrains.annotations.NotNull;
import java.util.LinkedHashSet;
/**
* The interface for internal API access, used by the Graphics subsystem.
* The interface for internal API access, used by the windowing subsystem.
*
* @since v1-alpha2
*/
public interface ApiInternalClass {
/**
* Returns the {@link Window} class of the Graphics API.
* Returns the {@link Window} class of the windowing API.
*
* @return {@link Window} class
* @since v1-alpha2

View file

@ -17,14 +17,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.classes.api;
package de.staropensource.sosengine.windowing.classes.api;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.utility.Math;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.graphics.GraphicsSubsystemConfiguration;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.types.window.VsyncMode;
import de.staropensource.sosengine.windowing.WindowingSubsystemConfiguration;
import de.staropensource.sosengine.windowing.classes.Window;
import de.staropensource.sosengine.windowing.types.window.VsyncMode;
import lombok.AccessLevel;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
@ -34,7 +34,7 @@ import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicReference;
/**
* The interface for Graphics API management classes.
* The interface for windowing API management classes.
*
* @since v1-alpha0
*/
@ -61,9 +61,9 @@ public abstract class ApiManagementClass {
public ApiManagementClass() {}
/**
* Returns if this Graphics API must be interacted with on the main thread.
* Returns if this windowing API must be interacted with on the main thread.
*
* @return {@code true} if Graphics API must be interacted with on the main thread, {@code false} otherwise
* @return {@code true} if windowing API must be interacted with on the main thread, {@code false} otherwise
* @since v1-alpha2
*/
public abstract boolean mustRunOnMainThread();
@ -103,17 +103,17 @@ public abstract class ApiManagementClass {
frameCode.run();
});
if (GraphicsSubsystemConfiguration.getInstance().getVsyncMode() != VsyncMode.OFF)
if (WindowingSubsystemConfiguration.getInstance().getVsyncMode() != VsyncMode.OFF)
// V-Sync is enabled, no need for manual busy waiting
sleepDuration = 0L;
else
// Calculate amount of time the thread should spend sleeping
sleepDuration = (long) (1d / GraphicsSubsystemConfiguration.getInstance().getMaximumFramesPerSecond() * 1000d) - renderTime;
sleepDuration = (long) (1d / WindowingSubsystemConfiguration.getInstance().getMaximumFramesPerSecond() * 1000d) - renderTime;
// Add render and sleep time to list used for calculating the delta time value
splitDeltaTime.add(renderTime + sleepDuration);
// Busy wait unless V-Sync is enabled
if (GraphicsSubsystemConfiguration.getInstance().getVsyncMode() == VsyncMode.OFF)
if (WindowingSubsystemConfiguration.getInstance().getVsyncMode() == VsyncMode.OFF)
try {
//noinspection BusyWait // true, true, but there's no other way to do it
Thread.sleep(sleepDuration);

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha2
*/
package de.staropensource.sosengine.graphics.classes.api;
package de.staropensource.sosengine.windowing.classes.api;

View file

@ -20,8 +20,8 @@
/**
* Interfaces and abstract classes which can be used for implementing classes.
* <p>
* These are not to be confused with data types. See {@link de.staropensource.sosengine.graphics.types}.
* These are not to be confused with data types. See {@link de.staropensource.sosengine.windowing.types}.
*
* @since v1-alpha0
*/
package de.staropensource.sosengine.graphics.classes;
package de.staropensource.sosengine.windowing.classes;

View file

@ -17,15 +17,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.events;
package de.staropensource.sosengine.windowing.events;
import de.staropensource.sosengine.base.classes.Event;
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.graphics.GraphicsSubsystemConfiguration;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.graphics.types.input.Key;
import de.staropensource.sosengine.graphics.types.input.KeyState;
import de.staropensource.sosengine.windowing.WindowingSubsystemConfiguration;
import de.staropensource.sosengine.windowing.classes.Window;
import de.staropensource.sosengine.windowing.types.input.Key;
import de.staropensource.sosengine.windowing.types.input.KeyState;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -61,13 +61,13 @@ public final class InputEvent implements Event {
/**
* Emits the event and calls all event listeners.
*
* @param window window the input originated from. May be {@code null}, depending on the Graphics API
* @param window window the input originated from. May be {@code null}, depending on the windowing API
* @param key key
* @param state key state
* @since v1-alpha0
*/
public void callEvent(@Nullable Window window, @NotNull Key key, @NotNull KeyState state) {
if (GraphicsSubsystemConfiguration.getInstance().isDebugInput())
if (WindowingSubsystemConfiguration.getInstance().isDebugInput())
logger.diag("Got input event: window=" + (window == null ? "\\<null>" : window.getUniqueIdentifier()) + " key=" + key.name() + " state=" + state.name());
EventHelper.invokeAnnotatedMethods(getClass(), window, key, state);

View file

@ -17,24 +17,24 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.events;
package de.staropensource.sosengine.windowing.events;
import de.staropensource.sosengine.base.classes.Event;
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
import org.jetbrains.annotations.NotNull;
/**
* Called when a graphics error occurs.
* Called when an error occurs in the renderer API (e.g. OpenGL, Vulkan).
*
* @since v1-alpha0
*/
public final class GraphicsApiErrorEvent implements Event {
public final class RenderingErrorEvent implements Event {
/**
* Constructs this class.
*
* @since v1-alpha0
*/
public GraphicsApiErrorEvent() {}
public RenderingErrorEvent() {}
/**
* {@inheritDoc}
@ -48,7 +48,7 @@ public final class GraphicsApiErrorEvent implements Event {
/**
* Emits the event and calls all event listeners.
*
* @param error graphics error
* @param error error description
* @since v1-alpha0
*/
public void callEvent(@NotNull String error) {

View file

@ -17,24 +17,24 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.events;
package de.staropensource.sosengine.windowing.events;
import de.staropensource.sosengine.base.classes.Event;
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
import org.jetbrains.annotations.NotNull;
/**
* Called when a graphics error occurs.
* Called when an error occurs in the windowing API.
*
* @since v1-alpha0
*/
public final class GraphicsErrorEvent implements Event {
public final class WindowingErrorEvent implements Event {
/**
* Constructs this class.
*
* @since v1-alpha0
*/
public GraphicsErrorEvent() {}
public WindowingErrorEvent() {}
/**
* {@inheritDoc}
@ -49,7 +49,7 @@ public final class GraphicsErrorEvent implements Event {
/**
* Emits the event and calls all event listeners.
*
* @param error graphics error
* @param error error description
* @since v1-alpha0
*/
public void callEvent(@NotNull String error) {

View file

@ -17,23 +17,23 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.events;
package de.staropensource.sosengine.windowing.events;
import de.staropensource.sosengine.base.classes.Event;
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
/**
* Called when the Graphics API shuts down.
* Called when the windowing API shuts down.
*
* @since v1-alpha0
*/
public final class GraphicsApiShutdownEvent implements Event {
public final class WindowingShutdownEvent implements Event {
/**
* Constructs this class.
*
* @since v1-alpha0
*/
public GraphicsApiShutdownEvent() {}
public WindowingShutdownEvent() {}
/** {@inheritDoc} */

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha0
*/
package de.staropensource.sosengine.graphics.events;
package de.staropensource.sosengine.windowing.events;

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.exceptions;
package de.staropensource.sosengine.windowing.exceptions;
/**
* Thrown when the specified monitor does not exist.

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.exceptions;
package de.staropensource.sosengine.windowing.exceptions;
/**
* Thrown when trying to access one or more monitors but none are found.

View file

@ -17,10 +17,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.exceptions;
package de.staropensource.sosengine.windowing.exceptions;
/**
* Thrown when trying to communicate with a Graphics API over a non-main thread.
* Thrown when trying to communicate with a windowing API over a non-main thread.
*
* @since v1-alpha2
*/

View file

@ -17,9 +17,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.exceptions;
package de.staropensource.sosengine.windowing.exceptions;
import de.staropensource.sosengine.graphics.classes.Window;
import de.staropensource.sosengine.windowing.classes.Window;
import org.jetbrains.annotations.NotNull;
/**

View file

@ -18,11 +18,11 @@
*/
/**
* Exceptions for Graphics APIs.
* Exceptions for windowing APIs.
* <p>
* These aren't meant for the Graphics subsystem,
* but instead for Graphics APIs, which may throw them.
* These aren't meant for the windowing subsystem,
* but instead for windowing APIs, which may throw them.
*
* @since v1-alpha2
*/
package de.staropensource.sosengine.graphics.exceptions;
package de.staropensource.sosengine.windowing.exceptions;

View file

@ -18,8 +18,8 @@
*/
/**
* Code of the Graphics subsystem.
* Code of the windowing subsystem.
*
* @since v1-alpha0
*/
package de.staropensource.sosengine.graphics;
package de.staropensource.sosengine.windowing;

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.types.input;
package de.staropensource.sosengine.windowing.types.input;
/**
* Contains a list of keys which can be recognized by the engine.

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.types.input;
package de.staropensource.sosengine.windowing.types.input;
/**
* Contains in which state a key is.

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha2
*/
package de.staropensource.sosengine.graphics.types.input;
package de.staropensource.sosengine.windowing.types.input;

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha1
*/
package de.staropensource.sosengine.graphics.types;
package de.staropensource.sosengine.windowing.types;

View file

@ -17,9 +17,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.types.window;
package de.staropensource.sosengine.windowing.types.window;
import de.staropensource.sosengine.graphics.GraphicsSubsystemConfiguration;
import de.staropensource.sosengine.windowing.WindowingSubsystemConfiguration;
/**
* Controls how <a href="https://en.wikipedia.org/wiki/Screen_tearing#Vertical_synchronization">V-Sync</a> operates.
@ -30,7 +30,7 @@ public enum VsyncMode {
/**
* Disables V-Sync. The frame rate will be uncapped and will allow
* for processing an unlimited amount of frames (if not limited by
* {@link GraphicsSubsystemConfiguration#maximumFramesPerSecond}).
* {@link WindowingSubsystemConfiguration#maximumFramesPerSecond}).
*
* @since v1-alpha1
*/

View file

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.staropensource.sosengine.graphics.types.window;
package de.staropensource.sosengine.windowing.types.window;
/**
* Contains how a window should be displayed.

View file

@ -22,4 +22,4 @@
*
* @since v1-alpha1
*/
package de.staropensource.sosengine.graphics.types.window;
package de.staropensource.sosengine.windowing.types.window;

View file

@ -0,0 +1,32 @@
/**
* The {@code windowing} subsystem, which provides abstractions and
* APIs, which allow the creation and management of windows.
*
* @since v1-alpha4
*/
module sosengine.windowing {
// Dependencies
// -> Subsystems
requires transitive sosengine.base;
// -> Libraries
requires transitive static lombok;
requires transitive org.jetbrains.annotations;
// API access
exports de.staropensource.sosengine.windowing;
exports de.staropensource.sosengine.windowing.classes;
exports de.staropensource.sosengine.windowing.classes.api;
exports de.staropensource.sosengine.windowing.events;
exports de.staropensource.sosengine.windowing.exceptions;
exports de.staropensource.sosengine.windowing.types.input;
exports de.staropensource.sosengine.windowing.types.window;
// Reflection access
opens de.staropensource.sosengine.windowing;
opens de.staropensource.sosengine.windowing.classes;
opens de.staropensource.sosengine.windowing.classes.api;
opens de.staropensource.sosengine.windowing.events;
opens de.staropensource.sosengine.windowing.exceptions;
opens de.staropensource.sosengine.windowing.types.input;
opens de.staropensource.sosengine.windowing.types.window;
}

View file

@ -19,6 +19,6 @@
<body>
<p>Welcome to the sos!engine API documentation!<br/>
You are currently in the documentation for the <b>opengl</b> subsystem, allowing the OpenGL Graphics API to be used.</p>
<p>This subsystem does not provide any utility for your application, as it just implements interfaces and classes from the <b>graphics</b> subsystem.</p>
You are currently in the documentation for the <b>windowing</b> subsystem, which provides abstract APIs for creating and managing windows and monitors.</p>
<p>This subsystem's interfaces are mainly useful for windowing APIs, creating implementations for them.</p>
</body>