Update Window interface
This commit is contained in:
parent
0514329556
commit
51f0405895
11 changed files with 189 additions and 21 deletions
|
@ -22,9 +22,9 @@ package de.staropensource.sosengine.graphics.opengl;
|
|||
import de.staropensource.sosengine.base.annotations.EventListener;
|
||||
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||
import de.staropensource.sosengine.base.types.CodePart;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
|
||||
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
package de.staropensource.sosengine.graphics.opengl.classes;
|
||||
|
||||
import de.staropensource.sosengine.base.types.Vec2i;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||
import de.staropensource.sosengine.base.types.CodePart;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.types.Vec2i;
|
||||
import de.staropensource.sosengine.graphics.events.GraphicsApiErrorEvent;
|
||||
import lombok.Getter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -31,8 +31,8 @@ import org.lwjgl.opengl.GL;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||
|
||||
/**
|
||||
* A window on your screen.
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
package de.staropensource.sosengine.graphics;
|
||||
|
||||
import de.staropensource.sosengine.base.classes.SubsystemConfiguration;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.logging.Logger;
|
||||
import de.staropensource.sosengine.base.types.CodePart;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.utility.PropertyParser;
|
||||
import de.staropensource.sosengine.graphics.events.GraphicsErrorEvent;
|
||||
import lombok.Getter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -85,7 +86,7 @@ public final class GraphicsSubsystemConfiguration implements SubsystemConfigurat
|
|||
/**
|
||||
* If enabled, graphical errors thrown by GLFW will be printed to the log by the subsystem.
|
||||
*
|
||||
* @see de.staropensource.sosengine.graphics.events.GraphicsErrorEvent
|
||||
* @see GraphicsErrorEvent
|
||||
* @since 1-alpha0
|
||||
*
|
||||
* -- GETTER --
|
||||
|
|
|
@ -21,8 +21,8 @@ package de.staropensource.sosengine.graphics.classes;
|
|||
|
||||
import de.staropensource.sosengine.base.Engine;
|
||||
import de.staropensource.sosengine.base.annotations.EventListener;
|
||||
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
||||
import de.staropensource.sosengine.base.classes.SubsystemMainClass;
|
||||
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
||||
import de.staropensource.sosengine.base.events.internal.InternalEngineShutdownEvent;
|
||||
import de.staropensource.sosengine.graphics.events.GraphicsErrorEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
package de.staropensource.sosengine.graphics.classes;
|
||||
|
||||
import de.staropensource.sosengine.base.types.Vec2i;
|
||||
import de.staropensource.sosengine.graphics.types.WindowMode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A window on your screen.
|
||||
* Interface for implementing windows.
|
||||
*
|
||||
* @since 1-alpha0
|
||||
*/
|
||||
|
@ -41,18 +42,54 @@ public interface Window {
|
|||
Set<? extends @NotNull Window> windows = new HashSet<>();
|
||||
|
||||
/**
|
||||
* The window name.
|
||||
* Contains the window identifier.
|
||||
*
|
||||
* @since 1-alpha0
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@NotNull
|
||||
String windowName = "Hello Window!";
|
||||
String identifier = "";
|
||||
|
||||
/**
|
||||
* The window size.
|
||||
* Determines the title of this window.
|
||||
*
|
||||
* @since 1-alpha0
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@NotNull
|
||||
Vec2i windowSize = new Vec2i(0, 0);
|
||||
String title = "sos!engine window (update this title)";
|
||||
|
||||
/**
|
||||
* Determines the size of this window.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@NotNull
|
||||
Vec2i size = new Vec2i(200, 200);
|
||||
|
||||
/**
|
||||
* Determines in which {@link WindowMode} this window is in.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
WindowMode mode = WindowMode.WINDOWED;
|
||||
|
||||
/**
|
||||
* Determines if this window should have a border and decorations.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
boolean borderless = false;
|
||||
|
||||
/**
|
||||
* Determines if this window should be displayed on top of all other windows.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
boolean onTop = false;
|
||||
|
||||
/**
|
||||
* Determines if this window can be resized by the user.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
boolean resizable = false;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,29 @@
|
|||
/*
|
||||
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||
* Licensed under the GNU Affero General Public License v3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.staropensource.sosengine.graphics.events;
|
||||
|
||||
import de.staropensource.sosengine.base.classes.events.Event;
|
||||
import de.staropensource.sosengine.base.events.LogEvent;
|
||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogLevel;
|
||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||
import de.staropensource.sosengine.base.events.LogEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
|
|
@ -1,10 +1,29 @@
|
|||
/*
|
||||
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||
* Licensed under the GNU Affero General Public License v3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.staropensource.sosengine.graphics.events;
|
||||
|
||||
import de.staropensource.sosengine.base.classes.events.Event;
|
||||
import de.staropensource.sosengine.base.events.LogEvent;
|
||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogLevel;
|
||||
import de.staropensource.sosengine.base.classes.helpers.EventHelper;
|
||||
import de.staropensource.sosengine.base.events.LogEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||
* Licensed under the GNU Affero General Public License v3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.staropensource.sosengine.graphics.types;
|
||||
|
||||
/**
|
||||
* Used for determining if and how a window's frame rate should be synchronized to the monitor's refresh rate.
|
||||
*/
|
||||
@SuppressWarnings({ "unused" })
|
||||
public enum VsyncMode {
|
||||
/**
|
||||
* Disables VSync. The frame rate can be uncapped and will allow for processing an unlimited amount of frames.
|
||||
*/
|
||||
OFF,
|
||||
|
||||
/**
|
||||
* Enables VSync and will cap the window's frame rate at the refresh rate of the target monitor.
|
||||
*/
|
||||
ON,
|
||||
|
||||
/**
|
||||
* This mode will disables VSync if the window's frame rate drops below the monitor's refresh rate and enable it otherwise.
|
||||
*/
|
||||
ADAPTIVE
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||
* Licensed under the GNU Affero General Public License v3
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.staropensource.sosengine.graphics.types;
|
||||
|
||||
/**
|
||||
* Determines how a window should be displayed.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
@SuppressWarnings({ "unused" })
|
||||
public enum WindowMode {
|
||||
/**
|
||||
* Makes the window able to be dragged around.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
WINDOWED,
|
||||
|
||||
/**
|
||||
* Same as {@code WINDOWED} mode, but the window will have
|
||||
* the same size as the monitor it is currently on.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
BORDERLESS_FULLSCREEN,
|
||||
|
||||
/**
|
||||
* Makes the window occupy the entire monitor it is currently on
|
||||
* without allowing other windows to occupy the same space.
|
||||
*
|
||||
* @since 1-alpha1
|
||||
*/
|
||||
EXCLUSIVE_FULLSCREEN
|
||||
}
|
|
@ -21,9 +21,9 @@ package de.staropensource.sosengine.graphics.vulkan;
|
|||
|
||||
import de.staropensource.sosengine.base.annotations.EventListener;
|
||||
import de.staropensource.sosengine.base.classes.events.EventPriority;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||
import de.staropensource.sosengine.base.types.CodePart;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
|
||||
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
package de.staropensource.sosengine.testapp;
|
||||
|
||||
import de.staropensource.sosengine.base.Engine;
|
||||
import de.staropensource.sosengine.base.types.Vec2i;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
||||
import de.staropensource.sosengine.base.types.CodePart;
|
||||
import de.staropensource.sosengine.base.classes.logging.LogIssuer;
|
||||
import de.staropensource.sosengine.base.types.Vec2i;
|
||||
import de.staropensource.sosengine.graphics.GraphicsSubsystem;
|
||||
import de.staropensource.sosengine.graphics.classes.ApiMainClass;
|
||||
import de.staropensource.sosengine.graphics.classes.ApiManagementClass;
|
||||
|
|
Loading…
Reference in a new issue