Skip to content

Commit

Permalink
Bump to JDK 23
Browse files Browse the repository at this point in the history
Update Marshal
  • Loading branch information
squid233 committed Aug 29, 2024
1 parent b8762e2 commit 1efe6fa
Show file tree
Hide file tree
Showing 18 changed files with 158 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
java: [
22
23-ea
]
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/setup-java@v4
with:
java-version: |
22
23-ea
distribution: 'temurin'
- name: Grant execute permission for gradlew
if: ${{ runner.os != 'Windows' }}
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

![License](https://img.shields.io/github/license/Over-Run/overrungl)

![Maven Central](https://img.shields.io/maven-central/v/io.github.over-run/overrungl)
[//]: # (![Maven Central](https://img.shields.io/maven-central/v/io.github.over-run/overrungl))
![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/io.github.over-run/overrungl?server=https%3A%2F%2Fs01.oss.sonatype.org)

[![Java CI with Gradle](https://github.com/Over-Run/overrungl/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/Over-Run/overrungl/actions/workflows/gradle.yml)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8279/badge)](https://www.bestpractices.dev/projects/8279)

## Introduction

Overrun Game Library is a high-performance library implemented with Java 22,
Overrun Game Library is a high-performance library implemented with Java 23,
which enables cross-platform access to a set of C/C++ library bindings, and provides some useful utilities.

### OverrunGL vs. LWJGL
Expand All @@ -29,8 +29,7 @@ the [samples](modules/samples/src/main/java/overrungl/demo).

We provided a modules customizer [here](https://over-run.github.io/overrungl-gen/).

Currently, we are developing with the first version,
and it uses preview features, which prevent users from using newer JDKs,
Currently, OverrunGL uses preview features, which prevent users from using newer JDKs,
so you have to use `-SNAPSHOT` version.

You can import with `io.github.over-run:overrungl-bom:{the version}` and other submodules.
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ projName=overrungl
projVersion=0.1.0-SNAPSHOT
projLicenseYear=2022-2024

jdkVersion=22
jdkVersion=23
jdkEnablePreview=true
#jdkEarlyAccessDoc=jdk22
jdkEarlyAccessDoc=jdk23
kotlinTargetJdkVersion=21

overrunMarshalVersion=0.1.0-alpha.28-jdk22
overrunMarshalVersion=0.1.0-alpha.30-jdk23
overrunPlatformVersion=1.0.0
jomlVersion=1.10.8
junitVersion=5.11.0
2 changes: 0 additions & 2 deletions modules/overrungl.core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ val targetJavaVersion = jdkVersion.toInt()
dependencies {
api("io.github.over-run:marshal:$overrunMarshalVersion")
api("io.github.over-run:platform:$overrunPlatformVersion")
//TODO
api("io.github.over-run:memstack:0.2.0")
}

tasks.register("assembleJavadocArgs") {
Expand Down
37 changes: 17 additions & 20 deletions modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFW.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import overrun.marshal.Downcall;
import overrun.marshal.Unmarshal;
import overrun.marshal.gen.*;
import overrun.marshal.gen.processor.ProcessorType.BoolConvert;
import overrungl.internal.RuntimeHelper;
import overrungl.util.value.Pair;
import overrungl.util.value.Quad;
Expand Down Expand Up @@ -1234,7 +1235,7 @@ static String getPlatformString(int platformCode) {
* @see #initAllocator
* @see #terminate
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwInit")
boolean init();

Expand Down Expand Up @@ -1404,7 +1405,6 @@ default Triplet.OfInt getVersion() {
* @see #ngetVersionString() ngetVersionString
*/
@Entrypoint("glfwGetVersionString")
@SizedSeg(Unmarshal.STR_SIZE)
@StrCharset("US-ASCII")
String getVersionString();

Expand Down Expand Up @@ -1527,7 +1527,7 @@ default MemorySegment setErrorCallback(@Nullable GLFWErrorFun callback) {
* @glfw.thread_safety This function may be called from any thread.
* @see #getPlatform
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwPlatformSupported")
boolean platformSupported(int platform);

Expand Down Expand Up @@ -1834,7 +1834,6 @@ default Pair.OfFloat getMonitorContentScale(MemorySegment monitor) {
*/
@Entrypoint("glfwGetMonitorName")
@Nullable
@SizedSeg(Unmarshal.STR_SIZE)
String getMonitorName(MemorySegment monitor);

/**
Expand Down Expand Up @@ -2147,7 +2146,7 @@ default GLFWVidMode getVideoMode(MemorySegment monitor) {
* @see #windowHint(int, int)
*/
@Entrypoint("glfwWindowHint")
void windowHint(int hint, @Convert(Type.INT) boolean value);
void windowHint(int hint, @Convert(BoolConvert.INT) boolean value);

/**
* Sets the specified window hint to the desired value.
Expand Down Expand Up @@ -2394,7 +2393,7 @@ default GLFWVidMode getVideoMode(MemorySegment monitor) {
* @glfw.thread_safety This function may be called from any thread. Access is not
* synchronized.
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwWindowShouldClose")
boolean windowShouldClose(MemorySegment window);

Expand All @@ -2412,7 +2411,7 @@ default GLFWVidMode getVideoMode(MemorySegment monitor) {
* synchronized.
*/
@Entrypoint("glfwSetWindowShouldClose")
void setWindowShouldClose(MemorySegment window, @Convert(Type.INT) boolean value);
void setWindowShouldClose(MemorySegment window, @Convert(BoolConvert.INT) boolean value);

/**
* Returns the title of the specified window.
Expand Down Expand Up @@ -2448,7 +2447,6 @@ default GLFWVidMode getVideoMode(MemorySegment monitor) {
* @see #ngetWindowTitle(MemorySegment)
*/
@Entrypoint("glfwGetWindowTitle")
@SizedSeg(Unmarshal.STR_SIZE)
String getWindowTitle(MemorySegment window);

/**
Expand Down Expand Up @@ -3296,7 +3294,7 @@ default Pair.OfFloat getWindowContentScale(MemorySegment window) {
* @see #getWindowAttrib(MemorySegment, int) getWindowAttrib
*/
@Entrypoint("glfwSetWindowAttrib")
void setWindowAttrib(MemorySegment window, int attrib, @Convert(Type.INT) boolean value);
void setWindowAttrib(MemorySegment window, int attrib, @Convert(BoolConvert.INT) boolean value);

/**
* Sets the user pointer of the specified window.
Expand Down Expand Up @@ -3901,7 +3899,7 @@ default MemorySegment setWindowContentScaleCallback(MemorySegment window, @Nulla
* @glfw.thread_safety This function must only be called from the main thread.
* @see #setInputMode(MemorySegment, int, int) setInputMode
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwRawMouseMotionSupported")
boolean rawMouseMotionSupported();

Expand Down Expand Up @@ -4593,7 +4591,7 @@ default MemorySegment setDropCallback(MemorySegment window, @Nullable GLFWDropFu
* {@link #INVALID_ENUM} and {@link #PLATFORM_ERROR}.
* @glfw.thread_safety This function must only be called from the main thread.
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwJoystickPresent")
boolean joystickPresent(int jid);

Expand Down Expand Up @@ -4901,7 +4899,7 @@ default byte[] getJoystickHats(int jid) {
* @glfw.thread_safety This function must only be called from the main thread.
* @see #ngetGamepadState(int, MemorySegment) getGamepadState
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwJoystickIsGamepad")
boolean joystickIsGamepad(int jid);

Expand Down Expand Up @@ -4972,7 +4970,7 @@ default MemorySegment setJoystickCallback(@Nullable GLFWJoystickFun callback) {
* @see #joystickIsGamepad(int) joystickIsGamepad
* @see #ngetGamepadName(int) getGamepadName
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwUpdateGamepadMappings")
boolean nupdateGamepadMappings(MemorySegment string);

Expand All @@ -4984,7 +4982,7 @@ default MemorySegment setJoystickCallback(@Nullable GLFWJoystickFun callback) {
* <a href="https://www.glfw.org/docs/latest/intro_guide.html#error_handling">error</a> occurred.
* @see #nupdateGamepadMappings(MemorySegment) nupdateGamepadMappings
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwUpdateGamepadMappings")
boolean updateGamepadMappings(String string);

Expand Down Expand Up @@ -5055,7 +5053,7 @@ default MemorySegment setJoystickCallback(@Nullable GLFWJoystickFun callback) {
* @see #nupdateGamepadMappings(MemorySegment) updateGamepadMappings
* @see #joystickIsGamepad(int) joystickIsGamepad
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwGetGamepadState")
boolean ngetGamepadState(int jid, MemorySegment state);

Expand All @@ -5069,7 +5067,7 @@ default MemorySegment setJoystickCallback(@Nullable GLFWJoystickFun callback) {
* occurred.
* @see #ngetGamepadState(int, MemorySegment) ngetGamepadState
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwGetGamepadState")
boolean getGamepadState(int jid, GLFWGamepadState state);

Expand Down Expand Up @@ -5153,7 +5151,6 @@ default void setClipboardString(String string) {
* @see #nsetClipboardString(MemorySegment) setClipboardString
*/
@Entrypoint("glfwGetClipboardString")
@SizedSeg(Unmarshal.STR_SIZE)
MemorySegment ngetClipboardString(MemorySegment window);

/**
Expand Down Expand Up @@ -5417,7 +5414,7 @@ default String getClipboardString() {
* @glfw.thread_safety This function may be called from any thread.
* @see #ngetProcAddress
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwExtensionSupported")
boolean nextensionSupported(MemorySegment extension);

Expand All @@ -5429,7 +5426,7 @@ default String getClipboardString() {
* otherwise.
* @see #nextensionSupported(MemorySegment) nextensionSupported
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwExtensionSupported")
boolean extensionSupported(@StrCharset("US-ASCII") String extension);

Expand Down Expand Up @@ -5497,7 +5494,7 @@ default String getClipboardString() {
* @glfw.errors Possible errors include {@link #NOT_INITIALIZED}.
* @glfw.thread_safety This function may be called from any thread.
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwVulkanSupported")
boolean vulkanSupported();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import overrun.marshal.gen.Convert;
import overrun.marshal.gen.Entrypoint;
import overrun.marshal.gen.Ref;
import overrun.marshal.gen.Type;
import overrun.marshal.gen.processor.ProcessorType.BoolConvert;

import java.lang.foreign.MemorySegment;
import java.lang.invoke.MethodHandles;
Expand Down Expand Up @@ -455,7 +455,7 @@ default MemorySegment getEGLSurface(MemorySegment window) {
* @glfw.thread_safety This function may be called from any thread. Access is not
* synchronized.
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwGetOSMesaColorBuffer")
default boolean ngetOSMesaColorBuffer(MemorySegment window, MemorySegment width, MemorySegment height, MemorySegment format, MemorySegment buffer) {
return false;
Expand All @@ -475,7 +475,7 @@ default boolean ngetOSMesaColorBuffer(MemorySegment window, MemorySegment width,
* <a href="https://www.glfw.org/docs/latest/intro_guide.html#error_handling">error</a> occurred.
* @see #ngetOSMesaColorBuffer(MemorySegment, MemorySegment, MemorySegment, MemorySegment, MemorySegment) ngetOSMesaColorBuffer
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwGetOSMesaColorBuffer")
default boolean getOSMesaColorBuffer(MemorySegment window, @Ref int @Nullable [] width, @Ref int @Nullable [] height, @Ref int @Nullable [] format, MemorySegment buffer) {
return false;
Expand All @@ -497,7 +497,7 @@ default boolean getOSMesaColorBuffer(MemorySegment window, @Ref int @Nullable []
* @glfw.thread_safety This function may be called from any thread. Access is not
* synchronized.
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwGetOSMesaDepthBuffer")
default boolean ngetOSMesaDepthBuffer(MemorySegment window, MemorySegment width, MemorySegment height, MemorySegment bytesPerValue, MemorySegment buffer) {
return false;
Expand All @@ -517,7 +517,7 @@ default boolean ngetOSMesaDepthBuffer(MemorySegment window, MemorySegment width,
* <a href="https://www.glfw.org/docs/latest/intro_guide.html#error_handling">error</a> occurred.
* @see #ngetOSMesaDepthBuffer(MemorySegment, MemorySegment, MemorySegment, MemorySegment, MemorySegment) ngetOSMesaDepthBuffer
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwGetOSMesaDepthBuffer")
default boolean getOSMesaDepthBuffer(MemorySegment window, @Ref int @Nullable [] width, @Ref int @Nullable [] height, @Ref int @Nullable [] bytesPerValue, MemorySegment buffer) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import overrun.marshal.gen.Convert;
import overrun.marshal.gen.Entrypoint;
import overrun.marshal.gen.Ref;
import overrun.marshal.gen.Type;
import overrun.marshal.gen.processor.ProcessorType.BoolConvert;
import overrungl.NativeType;

import java.lang.foreign.MemorySegment;
Expand Down Expand Up @@ -149,7 +149,7 @@ public interface GLFWVulkan extends DirectAccess {
* @glfw.thread_safety This function may be called from any thread. For
* synchronization details of Vulkan objects, see the Vulkan specification.
*/
@Convert(Type.INT)
@Convert(BoolConvert.INT)
@Entrypoint("glfwGetPhysicalDevicePresentationSupport")
boolean getPhysicalDevicePresentationSupport(MemorySegment instance, MemorySegment device, int queueFamily);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.lang.foreign.SymbolLookup;
import java.util.function.Supplier;

import static overrun.marshal.gen.processor.ProcessorTypes.registerStruct;

/**
* The GLFW method handles.
*
Expand All @@ -33,6 +35,12 @@ final class Handles {
static final SymbolLookup lookup;

static {
registerStruct(GLFWAllocator.class, GLFWAllocator.OF);
registerStruct(GLFWGamepadState.class, GLFWGamepadState.OF);
registerStruct(GLFWGammaRamp.class, GLFWGammaRamp.OF);
registerStruct(GLFWImage.class, GLFWImage.OF);
registerStruct(GLFWVidMode.class, GLFWVidMode.OF);

final Supplier<SymbolLookup> lib = () -> RuntimeHelper.load("glfw", "glfw", OverrunGL.GLFW_VERSION);
final var function = Configurations.GLFW_SYMBOL_LOOKUP.get();
lookup = function != null ? function.apply(lib) : lib.get();
Expand Down
Loading

0 comments on commit 1efe6fa

Please sign in to comment.