diff --git a/build.gradle b/build.gradle index b9d57c9..cecf143 100644 --- a/build.gradle +++ b/build.gradle @@ -31,10 +31,8 @@ tasks.register("javadocAll", Javadoc) { ":base", ":ansi", ":slf4j-compat", - ":graphics", - ":graphics:glfw", - ":graphics:opengl", - ":graphics:vulkan", + ":windowing", + ":windowing:glfw", ] // Task metadata diff --git a/docs/docs/getting-started/initializing.md b/docs/docs/getting-started/initializing.md index cc7051d..44b7e7a 100644 --- a/docs/docs/getting-started/initializing.md +++ b/docs/docs/getting-started/initializing.md @@ -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: diff --git a/docs/docs/javadoc.md b/docs/docs/javadoc.md index 85bf1a3..5dfd128 100644 --- a/docs/docs/javadoc.md +++ b/docs/docs/javadoc.md @@ -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/) diff --git a/docs/docs/welcome.md b/docs/docs/welcome.md index e5fd24b..08165e1 100644 --- a/docs/docs/welcome.md +++ b/docs/docs/welcome.md @@ -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). diff --git a/graphics/README.md b/graphics/README.md deleted file mode 100644 index 84cfab8..0000000 --- a/graphics/README.md +++ /dev/null @@ -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. diff --git a/graphics/glfw/src/main/java/module-info.java b/graphics/glfw/src/main/java/module-info.java deleted file mode 100644 index 98241e7..0000000 --- a/graphics/glfw/src/main/java/module-info.java +++ /dev/null @@ -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; -} diff --git a/graphics/opengl/README.md b/graphics/opengl/README.md deleted file mode 100644 index ed74c4a..0000000 --- a/graphics/opengl/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# The `opengl` subsystem -This subsystem is a Graphics API, bringing OpenGL into the engine. diff --git a/graphics/opengl/build.gradle b/graphics/opengl/build.gradle deleted file mode 100644 index 6e7d6fc..0000000 --- a/graphics/opengl/build.gradle +++ /dev/null @@ -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 . - */ - -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 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") - } -} diff --git a/graphics/opengl/gradle b/graphics/opengl/gradle deleted file mode 120000 index 1ce6c4c..0000000 --- a/graphics/opengl/gradle +++ /dev/null @@ -1 +0,0 @@ -../../gradle \ No newline at end of file diff --git a/graphics/opengl/gradlew b/graphics/opengl/gradlew deleted file mode 120000 index 343e0d2..0000000 --- a/graphics/opengl/gradlew +++ /dev/null @@ -1 +0,0 @@ -../../gradlew \ No newline at end of file diff --git a/graphics/opengl/gradlew.bat b/graphics/opengl/gradlew.bat deleted file mode 120000 index cb5a946..0000000 --- a/graphics/opengl/gradlew.bat +++ /dev/null @@ -1 +0,0 @@ -../../gradlew.bat \ No newline at end of file diff --git a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlInternalApi.java b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlInternalApi.java deleted file mode 100644 index 353333d..0000000 --- a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlInternalApi.java +++ /dev/null @@ -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 . - */ - -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 getWindowClass() { - return OpenGlWindow.class; - } - - /** {@inheritDoc} */ - @Override - public @NotNull Class getMonitorClass() { - return GlfwMonitor.class; - } -} diff --git a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlManagement.java b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlManagement.java deleted file mode 100644 index 063121d..0000000 --- a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlManagement.java +++ /dev/null @@ -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 . - */ - -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() {} -} diff --git a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlSubsystem.java b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlSubsystem.java deleted file mode 100644 index 43dc922..0000000 --- a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/OpenGlSubsystem.java +++ /dev/null @@ -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 . - */ - -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); - } -} diff --git a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/OpenGlWindow.java b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/OpenGlWindow.java deleted file mode 100644 index cd056cb..0000000 --- a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/OpenGlWindow.java +++ /dev/null @@ -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 . - */ - -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); - } -} diff --git a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/package-info.java b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/package-info.java deleted file mode 100644 index f826f16..0000000 --- a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/classes/package-info.java +++ /dev/null @@ -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 . - */ - -/** - * Interfaces and abstract classes which can be used for implementing classes. - * - * @since v1-alpha0 - */ -package de.staropensource.sosengine.graphics.opengl.classes; diff --git a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/package-info.java b/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/package-info.java deleted file mode 100644 index d0dae05..0000000 --- a/graphics/opengl/src/main/java/de/staropensource/sosengine/graphics/opengl/package-info.java +++ /dev/null @@ -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 . - */ - -/** - * Code of the OpenGL Graphics API. - * - * @since v1-alpha0 - */ -package de.staropensource.sosengine.graphics.opengl; diff --git a/graphics/opengl/src/main/java/module-info.java b/graphics/opengl/src/main/java/module-info.java deleted file mode 100644 index 9d983a2..0000000 --- a/graphics/opengl/src/main/java/module-info.java +++ /dev/null @@ -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; -} diff --git a/graphics/opengl/src/main/javadoc/theme.css b/graphics/opengl/src/main/javadoc/theme.css deleted file mode 120000 index bccac6b..0000000 --- a/graphics/opengl/src/main/javadoc/theme.css +++ /dev/null @@ -1 +0,0 @@ -../../../../../src/main/javadoc/theme.css \ No newline at end of file diff --git a/graphics/src/main/java/module-info.java b/graphics/src/main/java/module-info.java deleted file mode 100644 index 8752cb4..0000000 --- a/graphics/src/main/java/module-info.java +++ /dev/null @@ -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; -} diff --git a/graphics/src/main/javadoc/overview.html b/graphics/src/main/javadoc/overview.html deleted file mode 100644 index 2cbb49e..0000000 --- a/graphics/src/main/javadoc/overview.html +++ /dev/null @@ -1,24 +0,0 @@ - - - -

Welcome to the sos!engine API documentation!
- You are currently in the documentation for the graphics subsystem, which provides APIs for interfacing with Graphics APIs.

-

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.

- diff --git a/graphics/vulkan/README.md b/graphics/vulkan/README.md deleted file mode 100644 index 2450537..0000000 --- a/graphics/vulkan/README.md +++ /dev/null @@ -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. diff --git a/graphics/vulkan/build.gradle b/graphics/vulkan/build.gradle deleted file mode 100644 index f1f163b..0000000 --- a/graphics/vulkan/build.gradle +++ /dev/null @@ -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 . - */ - -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 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") - } -} diff --git a/graphics/vulkan/gradle b/graphics/vulkan/gradle deleted file mode 120000 index 1ce6c4c..0000000 --- a/graphics/vulkan/gradle +++ /dev/null @@ -1 +0,0 @@ -../../gradle \ No newline at end of file diff --git a/graphics/vulkan/gradlew b/graphics/vulkan/gradlew deleted file mode 120000 index 343e0d2..0000000 --- a/graphics/vulkan/gradlew +++ /dev/null @@ -1 +0,0 @@ -../../gradlew \ No newline at end of file diff --git a/graphics/vulkan/gradlew.bat b/graphics/vulkan/gradlew.bat deleted file mode 120000 index cb5a946..0000000 --- a/graphics/vulkan/gradlew.bat +++ /dev/null @@ -1 +0,0 @@ -../../gradlew.bat \ No newline at end of file diff --git a/graphics/vulkan/src/main/java/de/staropensource/sosengine/graphics/vulkan/VulkanSubsystem.java b/graphics/vulkan/src/main/java/de/staropensource/sosengine/graphics/vulkan/VulkanSubsystem.java deleted file mode 100644 index 93c0383..0000000 --- a/graphics/vulkan/src/main/java/de/staropensource/sosengine/graphics/vulkan/VulkanSubsystem.java +++ /dev/null @@ -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 . - */ - -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(); - } -} diff --git a/graphics/vulkan/src/main/java/de/staropensource/sosengine/graphics/vulkan/package-info.java b/graphics/vulkan/src/main/java/de/staropensource/sosengine/graphics/vulkan/package-info.java deleted file mode 100644 index e288c7d..0000000 --- a/graphics/vulkan/src/main/java/de/staropensource/sosengine/graphics/vulkan/package-info.java +++ /dev/null @@ -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 . - */ - -/** - * Code of the Vulkan Graphics API. - * - * @since v1-alpha0 - */ -package de.staropensource.sosengine.graphics.vulkan; diff --git a/graphics/vulkan/src/main/java/module-info.java b/graphics/vulkan/src/main/java/module-info.java deleted file mode 100644 index 42feba1..0000000 --- a/graphics/vulkan/src/main/java/module-info.java +++ /dev/null @@ -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; -} diff --git a/graphics/vulkan/src/main/javadoc/overview.html b/graphics/vulkan/src/main/javadoc/overview.html deleted file mode 100644 index 618963a..0000000 --- a/graphics/vulkan/src/main/javadoc/overview.html +++ /dev/null @@ -1,24 +0,0 @@ - - - -

Welcome to the sos!engine API documentation!
- You are currently in the documentation for the vulkan subsystem, allowing the Vulkan Graphics API to be used.

-

This subsystem does not provide any utility for your application, as it just implements interfaces and classes from the graphics subsystem.

- diff --git a/graphics/vulkan/src/main/javadoc/theme.css b/graphics/vulkan/src/main/javadoc/theme.css deleted file mode 120000 index bccac6b..0000000 --- a/graphics/vulkan/src/main/javadoc/theme.css +++ /dev/null @@ -1 +0,0 @@ -../../../../../src/main/javadoc/theme.css \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index a4f3023..c182b57 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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") diff --git a/testapp/build.gradle b/testapp/build.gradle index 8b95520..bfcb965 100644 --- a/testapp/build.gradle +++ b/testapp/build.gradle @@ -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 diff --git a/testapp/src/main/java/de/staropensource/sosengine/testapp/Main.java b/testapp/src/main/java/de/staropensource/sosengine/testapp/Main.java index 36e10be..8b1ab12 100644 --- a/testapp/src/main/java/de/staropensource/sosengine/testapp/Main.java +++ b/testapp/src/main/java/de/staropensource/sosengine/testapp/Main.java @@ -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() diff --git a/testapp/src/main/java/module-info.java b/testapp/src/main/java/module-info.java index 0133a06..bb89fa3 100644 --- a/testapp/src/main/java/module-info.java +++ b/testapp/src/main/java/module-info.java @@ -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; diff --git a/windowing/README.md b/windowing/README.md new file mode 100644 index 0000000..9c9adcc --- /dev/null +++ b/windowing/README.md @@ -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. diff --git a/graphics/build.gradle b/windowing/build.gradle similarity index 100% rename from graphics/build.gradle rename to windowing/build.gradle diff --git a/graphics/glfw/build.gradle b/windowing/glfw/build.gradle similarity index 99% rename from graphics/glfw/build.gradle rename to windowing/glfw/build.gradle index 9cae423..3abc018 100644 --- a/graphics/glfw/build.gradle +++ b/windowing/glfw/build.gradle @@ -79,7 +79,7 @@ dependencies { // -> Project <- implementation(project(":base")) - implementation(project(":graphics")) + implementation(project(":windowing")) } // Fix delombok task diff --git a/graphics/glfw/gradle b/windowing/glfw/gradle similarity index 100% rename from graphics/glfw/gradle rename to windowing/glfw/gradle diff --git a/graphics/glfw/gradlew b/windowing/glfw/gradlew similarity index 100% rename from graphics/glfw/gradlew rename to windowing/glfw/gradlew diff --git a/graphics/glfw/gradlew.bat b/windowing/glfw/gradlew.bat similarity index 100% rename from graphics/glfw/gradlew.bat rename to windowing/glfw/gradlew.bat diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/GlfwSubsystem.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/GlfwSubsystem.java similarity index 93% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/GlfwSubsystem.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/GlfwSubsystem.java index 144f543..628e477 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/GlfwSubsystem.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/GlfwSubsystem.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -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()) diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/GlfwSubsystemConfiguration.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/GlfwSubsystemConfiguration.java similarity index 95% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/GlfwSubsystemConfiguration.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/GlfwSubsystemConfiguration.java index 0bbacec..46a22a6 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/GlfwSubsystemConfiguration.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/GlfwSubsystemConfiguration.java @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -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. diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/KeyCallback.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/KeyCallback.java similarity index 95% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/KeyCallback.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/KeyCallback.java index e2b2490..a9020f5 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/KeyCallback.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/KeyCallback.java @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -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; diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/MouseButtonCallback.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/MouseButtonCallback.java similarity index 88% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/MouseButtonCallback.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/MouseButtonCallback.java index 5bda0f3..95c6d33 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/MouseButtonCallback.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/MouseButtonCallback.java @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -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; diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/package-info.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/package-info.java similarity index 93% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/package-info.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/package-info.java index 65e4f8e..d8ffc15 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/callbacks/package-info.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/callbacks/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha2 */ -package de.staropensource.sosengine.graphics.glfw.callbacks; +package de.staropensource.sosengine.windowing.glfw.callbacks; diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwInternalClass.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwInternalClass.java similarity index 89% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwInternalClass.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwInternalClass.java index 2257e61..11b68d6 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwInternalClass.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwInternalClass.java @@ -17,12 +17,12 @@ * along with this program. If not, see . */ -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 */ diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwManagementClass.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwManagementClass.java similarity index 89% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwManagementClass.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwManagementClass.java index b16a7e2..3e4a27f 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwManagementClass.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwManagementClass.java @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -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 */ diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwMonitor.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwMonitor.java similarity index 94% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwMonitor.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwMonitor.java index 618089f..1cf9c0f 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwMonitor.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwMonitor.java @@ -17,11 +17,11 @@ * along with this program. If not, see . */ -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; diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwWindow.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwWindow.java similarity index 92% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwWindow.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwWindow.java index 94f7b9d..0975523 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/GlfwWindow.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/GlfwWindow.java @@ -17,23 +17,23 @@ * along with this program. If not, see . */ -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 diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/WindowCallback.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/WindowCallback.java similarity index 93% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/WindowCallback.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/WindowCallback.java index 4112157..8183e22 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/WindowCallback.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/WindowCallback.java @@ -17,9 +17,9 @@ * along with this program. If not, see . */ -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; diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/package-info.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/package-info.java similarity index 90% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/package-info.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/package-info.java index 61b4b2e..2f94763 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/classes/package-info.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/classes/package-info.java @@ -20,6 +20,6 @@ /** * Interfaces and abstract classes which can be used for implementing classes. *

- * 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; diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/exceptions/GlfwInitializationException.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/exceptions/GlfwInitializationException.java similarity index 94% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/exceptions/GlfwInitializationException.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/exceptions/GlfwInitializationException.java index bc5dbde..f2934be 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/exceptions/GlfwInitializationException.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/exceptions/GlfwInitializationException.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.staropensource.sosengine.graphics.glfw.exceptions; +package de.staropensource.sosengine.windowing.glfw.exceptions; /** * Thrown when GLFW fails to initialize. diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/exceptions/package-info.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/exceptions/package-info.java similarity index 93% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/exceptions/package-info.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/exceptions/package-info.java index e4b8dde..9369751 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/exceptions/package-info.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/exceptions/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha2 */ -package de.staropensource.sosengine.graphics.glfw.exceptions; +package de.staropensource.sosengine.windowing.glfw.exceptions; diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/package-info.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/package-info.java similarity index 94% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/package-info.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/package-info.java index e3ac231..c7cc926 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/package-info.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha2 */ -package de.staropensource.sosengine.graphics.glfw; +package de.staropensource.sosengine.windowing.glfw; diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/types/GlfwPlatform.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/types/GlfwPlatform.java similarity index 96% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/types/GlfwPlatform.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/types/GlfwPlatform.java index e1a819e..84694d7 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/types/GlfwPlatform.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/types/GlfwPlatform.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.staropensource.sosengine.graphics.glfw.types; +package de.staropensource.sosengine.windowing.glfw.types; /** * Contains all available platforms which GLFW can be initialized with. diff --git a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/types/package-info.java b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/types/package-info.java similarity index 94% rename from graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/types/package-info.java rename to windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/types/package-info.java index 50e1d4c..d5616fc 100644 --- a/graphics/glfw/src/main/java/de/staropensource/sosengine/graphics/glfw/types/package-info.java +++ b/windowing/glfw/src/main/java/de/staropensource/sosengine/windowing/glfw/types/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha2 */ -package de.staropensource.sosengine.graphics.glfw.types; +package de.staropensource.sosengine.windowing.glfw.types; diff --git a/windowing/glfw/src/main/java/module-info.java b/windowing/glfw/src/main/java/module-info.java new file mode 100644 index 0000000..0508fc6 --- /dev/null +++ b/windowing/glfw/src/main/java/module-info.java @@ -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; +} diff --git a/graphics/glfw/src/main/javadoc/overview.html b/windowing/glfw/src/main/javadoc/overview.html similarity index 100% rename from graphics/glfw/src/main/javadoc/overview.html rename to windowing/glfw/src/main/javadoc/overview.html diff --git a/graphics/glfw/src/main/javadoc/theme.css b/windowing/glfw/src/main/javadoc/theme.css similarity index 100% rename from graphics/glfw/src/main/javadoc/theme.css rename to windowing/glfw/src/main/javadoc/theme.css diff --git a/graphics/gradle b/windowing/gradle similarity index 100% rename from graphics/gradle rename to windowing/gradle diff --git a/graphics/gradlew b/windowing/gradlew similarity index 100% rename from graphics/gradlew rename to windowing/gradlew diff --git a/graphics/gradlew.bat b/windowing/gradlew.bat similarity index 100% rename from graphics/gradlew.bat rename to windowing/gradlew.bat diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/GraphicsSubsystem.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/WindowingSubsystem.java similarity index 65% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/GraphicsSubsystem.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/WindowingSubsystem.java index 99b76a4..5b04508 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/GraphicsSubsystem.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/WindowingSubsystem.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -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; } diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/GraphicsSubsystemConfiguration.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/WindowingSubsystemConfiguration.java similarity index 76% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/GraphicsSubsystemConfiguration.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/WindowingSubsystemConfiguration.java index d8aa7bf..0cbda15 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/GraphicsSubsystemConfiguration.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/WindowingSubsystemConfiguration.java @@ -17,24 +17,25 @@ * along with this program. If not, see . */ -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.
+ * 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; } diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/Monitor.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/Monitor.java similarity index 85% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/classes/Monitor.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/classes/Monitor.java index 8471a7f..65cfba0 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/Monitor.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/Monitor.java @@ -17,13 +17,13 @@ * along with this program. If not, see . */ -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. *

* 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. *

- * 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. *

- * 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. *

- * 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(); } /** diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/Window.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/Window.java similarity index 96% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/classes/Window.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/classes/Window.java index ec1dbd5..17e2cd6 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/Window.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/Window.java @@ -17,14 +17,14 @@ * along with this program. If not, see . */ -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. *

* 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. *

- * 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. *

- * 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. *

- * 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. *

- * 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. *

- * 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. *

- * 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. *

* 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) { diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiClass.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiClass.java similarity index 69% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiClass.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiClass.java index 1f352ed..906ccfe 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiClass.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiClass.java @@ -17,16 +17,14 @@ * along with this program. If not, see . */ -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. *

* 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) {} } diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiInternalClass.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiInternalClass.java similarity index 76% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiInternalClass.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiInternalClass.java index 4007b96..0705bda 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiInternalClass.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiInternalClass.java @@ -17,23 +17,23 @@ * along with this program. If not, see . */ -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 diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiManagementClass.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiManagementClass.java similarity index 86% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiManagementClass.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiManagementClass.java index 54064fa..be6b2a6 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/ApiManagementClass.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/ApiManagementClass.java @@ -17,14 +17,14 @@ * along with this program. If not, see . */ -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); diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/package-info.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/package-info.java similarity index 93% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/package-info.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/package-info.java index b12619b..04b9a98 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/api/package-info.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/api/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha2 */ -package de.staropensource.sosengine.graphics.classes.api; +package de.staropensource.sosengine.windowing.classes.api; diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/package-info.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/package-info.java similarity index 91% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/classes/package-info.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/classes/package-info.java index 053c62a..185596f 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/classes/package-info.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/classes/package-info.java @@ -20,8 +20,8 @@ /** * Interfaces and abstract classes which can be used for implementing classes. *

- * 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; diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/InputEvent.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/InputEvent.java similarity index 84% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/events/InputEvent.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/events/InputEvent.java index e45e6f2..659cc4f 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/InputEvent.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/InputEvent.java @@ -17,15 +17,15 @@ * along with this program. If not, see . */ -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 ? "\\" : window.getUniqueIdentifier()) + " key=" + key.name() + " state=" + state.name()); EventHelper.invokeAnnotatedMethods(getClass(), window, key, state); diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsApiErrorEvent.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/RenderingErrorEvent.java similarity index 85% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsApiErrorEvent.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/events/RenderingErrorEvent.java index 3994f1c..4b330fe 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsApiErrorEvent.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/RenderingErrorEvent.java @@ -17,24 +17,24 @@ * along with this program. If not, see . */ -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) { diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsErrorEvent.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/WindowingErrorEvent.java similarity index 86% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsErrorEvent.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/events/WindowingErrorEvent.java index 714a529..01bf79b 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsErrorEvent.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/WindowingErrorEvent.java @@ -17,24 +17,24 @@ * along with this program. If not, see . */ -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) { diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsApiShutdownEvent.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/WindowingShutdownEvent.java similarity index 85% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsApiShutdownEvent.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/events/WindowingShutdownEvent.java index 9cca4a9..1601587 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/GraphicsApiShutdownEvent.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/WindowingShutdownEvent.java @@ -17,23 +17,23 @@ * along with this program. If not, see . */ -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} */ diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/package-info.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/package-info.java similarity index 94% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/events/package-info.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/events/package-info.java index be3016d..acd7344 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/events/package-info.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/events/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha0 */ -package de.staropensource.sosengine.graphics.events; +package de.staropensource.sosengine.windowing.events; diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/InvalidMonitorException.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/InvalidMonitorException.java similarity index 95% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/InvalidMonitorException.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/InvalidMonitorException.java index 925948e..9ac334e 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/InvalidMonitorException.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/InvalidMonitorException.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.staropensource.sosengine.graphics.exceptions; +package de.staropensource.sosengine.windowing.exceptions; /** * Thrown when the specified monitor does not exist. diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/NoMonitorsFoundException.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/NoMonitorsFoundException.java similarity index 95% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/NoMonitorsFoundException.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/NoMonitorsFoundException.java index 06efd4c..56ca529 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/NoMonitorsFoundException.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/NoMonitorsFoundException.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -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. diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/NotOnMainThreadException.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/NotOnMainThreadException.java similarity index 88% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/NotOnMainThreadException.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/NotOnMainThreadException.java index 7dcdbf5..f5e815e 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/NotOnMainThreadException.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/NotOnMainThreadException.java @@ -17,10 +17,10 @@ * along with this program. If not, see . */ -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 */ diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/WindowCreationFailureException.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/WindowCreationFailureException.java similarity index 92% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/WindowCreationFailureException.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/WindowCreationFailureException.java index fb58575..47c64ed 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/WindowCreationFailureException.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/WindowCreationFailureException.java @@ -17,9 +17,9 @@ * along with this program. If not, see . */ -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; /** diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/package-info.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/package-info.java similarity index 81% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/package-info.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/package-info.java index 19a49b3..de37ae2 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/exceptions/package-info.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/exceptions/package-info.java @@ -18,11 +18,11 @@ */ /** - * Exceptions for Graphics APIs. + * Exceptions for windowing APIs. *

- * 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; diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/package-info.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/package-info.java similarity index 91% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/package-info.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/package-info.java index 41e709b..5f296a4 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/package-info.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/package-info.java @@ -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; diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/Key.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/Key.java similarity index 99% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/Key.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/Key.java index 808ffcf..fc0305e 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/Key.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/Key.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -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. diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/KeyState.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/KeyState.java similarity index 95% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/KeyState.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/KeyState.java index c9f040b..338af9e 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/KeyState.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/KeyState.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.staropensource.sosengine.graphics.types.input; +package de.staropensource.sosengine.windowing.types.input; /** * Contains in which state a key is. diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/package-info.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/package-info.java similarity index 93% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/package-info.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/package-info.java index 91e026f..2ea2cd2 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/input/package-info.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/input/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha2 */ -package de.staropensource.sosengine.graphics.types.input; +package de.staropensource.sosengine.windowing.types.input; diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/package-info.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/package-info.java similarity index 94% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/types/package-info.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/types/package-info.java index 492ccad..8b8015e 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/package-info.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha1 */ -package de.staropensource.sosengine.graphics.types; +package de.staropensource.sosengine.windowing.types; diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/VsyncMode.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/VsyncMode.java similarity index 86% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/VsyncMode.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/VsyncMode.java index 5b78266..b326fdc 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/VsyncMode.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/VsyncMode.java @@ -17,9 +17,9 @@ * along with this program. If not, see . */ -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 V-Sync 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 */ diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/WindowMode.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/WindowMode.java similarity index 97% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/WindowMode.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/WindowMode.java index 62d9cd1..dfa7e36 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/WindowMode.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/WindowMode.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package de.staropensource.sosengine.graphics.types.window; +package de.staropensource.sosengine.windowing.types.window; /** * Contains how a window should be displayed. diff --git a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/package-info.java b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/package-info.java similarity index 93% rename from graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/package-info.java rename to windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/package-info.java index a5daa2b..8b05e82 100644 --- a/graphics/src/main/java/de/staropensource/sosengine/graphics/types/window/package-info.java +++ b/windowing/src/main/java/de/staropensource/sosengine/windowing/types/window/package-info.java @@ -22,4 +22,4 @@ * * @since v1-alpha1 */ -package de.staropensource.sosengine.graphics.types.window; +package de.staropensource.sosengine.windowing.types.window; diff --git a/windowing/src/main/java/module-info.java b/windowing/src/main/java/module-info.java new file mode 100644 index 0000000..a1f1c90 --- /dev/null +++ b/windowing/src/main/java/module-info.java @@ -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; +} diff --git a/graphics/opengl/src/main/javadoc/overview.html b/windowing/src/main/javadoc/overview.html similarity index 76% rename from graphics/opengl/src/main/javadoc/overview.html rename to windowing/src/main/javadoc/overview.html index 9883bd5..c328d0b 100644 --- a/graphics/opengl/src/main/javadoc/overview.html +++ b/windowing/src/main/javadoc/overview.html @@ -19,6 +19,6 @@

Welcome to the sos!engine API documentation!
- You are currently in the documentation for the opengl subsystem, allowing the OpenGL Graphics API to be used.

-

This subsystem does not provide any utility for your application, as it just implements interfaces and classes from the graphics subsystem.

+ You are currently in the documentation for the windowing subsystem, which provides abstract APIs for creating and managing windows and monitors.

+

This subsystem's interfaces are mainly useful for windowing APIs, creating implementations for them.

diff --git a/graphics/src/main/javadoc/theme.css b/windowing/src/main/javadoc/theme.css similarity index 100% rename from graphics/src/main/javadoc/theme.css rename to windowing/src/main/javadoc/theme.css