Add ability to inject custom rendering code, open GLFW subsystem
Some checks failed
build-and-test / build (push) Failing after 1m18s
build-and-test / generate-javadoc (push) Failing after 1m18s
build-and-test / test (push) Successful in 1m24s

This commit is contained in:
JeremyStar™ 2024-10-18 16:24:10 +02:00
parent c2028cfa33
commit 6f8d190d6f
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 18 additions and 1 deletions

View file

@ -34,6 +34,7 @@ import de.staropensource.engine.windowing.implementable.Window;
import de.staropensource.engine.windowing.type.window.VsyncMode; import de.staropensource.engine.windowing.type.window.VsyncMode;
import de.staropensource.engine.windowing.type.window.WindowMode; import de.staropensource.engine.windowing.type.window.WindowMode;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -73,6 +74,20 @@ public final class GlfwWindow extends Window {
@Getter @Getter
private long identifierLong; private long identifierLong;
/**
* Contains the code to execute in {@link #render()}.
*
* @since v1-alpha8
* -- GETTER --
* Returns the code to execute in {@link #render()}.
*
* @return rendering code
* @since v1-alpha8
*/
@Getter
@Setter
private @NotNull Runnable renderCode = () -> glfwSwapBuffers(identifierLong);
/** /**
* Contains the {@link GLFWKeyCallback} used for emitting {@link InputEvent}s. * Contains the {@link GLFWKeyCallback} used for emitting {@link InputEvent}s.
* *
@ -279,7 +294,7 @@ public final class GlfwWindow extends Window {
if (!Miscellaneous.onMainThread()) if (!Miscellaneous.onMainThread())
throw new NotOnMainThreadException(); throw new NotOnMainThreadException();
glfwSwapBuffers(identifierLong); renderCode.run();
} }
// ------------------------------------------------ [ GLFW handling ] ------------------------------------------------ // // ------------------------------------------------ [ GLFW handling ] ------------------------------------------------ //

View file

@ -17,7 +17,9 @@ module sosengine.windowing.glfw {
// API access // API access
exports de.staropensource.engine.windowing.glfw; exports de.staropensource.engine.windowing.glfw;
exports de.staropensource.engine.windowing.glfw.implementation;
// Reflection access // Reflection access
opens de.staropensource.engine.windowing.glfw; opens de.staropensource.engine.windowing.glfw;
opens de.staropensource.engine.windowing.glfw.implementation;
} }