Add ability to inject custom rendering code, open GLFW subsystem
This commit is contained in:
parent
c2028cfa33
commit
6f8d190d6f
2 changed files with 18 additions and 1 deletions
|
@ -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 ] ------------------------------------------------ //
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue