Skip to content

Commit 5944e18

Browse files
committed
0.7.19
- offered a static GlfwWindow constructor counterpart for the constructors using inline classes (for Java) - added a test - fixed previous tests
1 parent 92c8e73 commit 5944e18

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

core/src/main/kotlin/uno/glfw/GlfwWindow.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import org.lwjgl.glfw.*
1111
import org.lwjgl.glfw.GLFW.*
1212
import org.lwjgl.system.MemoryStack
1313
import org.lwjgl.system.MemoryUtil
14-
import org.lwjgl.system.MemoryUtil.memGetAddress
15-
import org.lwjgl.system.MemoryUtil.memUTF8
14+
import org.lwjgl.system.MemoryUtil.*
1615
import org.lwjgl.system.Pointer
1716
import uno.kotlin.*
1817
import java.util.*
1918
import java.util.function.BooleanSupplier
2019
import java.util.function.Consumer
20+
2121
open class GlfwWindow(var handle: Long) {
2222

2323
@Throws(RuntimeException::class)
@@ -565,7 +565,11 @@ open class GlfwWindow(var handle: Long) {
565565
companion object {
566566
infix fun fromWin32Window(hwnd: HWND): GlfwWindow = glfw attachWin32Window hwnd
567567

568-
@JvmStatic
569-
infix fun from(handle: Long): GlfwWindow = GlfwWindow(handle)
568+
@JvmStatic @Throws(RuntimeException::class)
569+
fun create(width: Int, height: Int,
570+
title: String = "Glfw Window",
571+
monitor: Long = MemoryUtil.NULL,
572+
share: GlfwWindow? = null,
573+
position: Vec2i? = null): GlfwWindow = GlfwWindow(glfwCreateWindow(width, height, title, monitor, share?.handle ?: NULL))
570574
}
571575
}

core/src/test/java/Test.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import glm_.vec2.Vec2i;
2+
import org.lwjgl.system.MemoryUtil;
3+
import uno.glfw.GlfwWindow;
4+
import uno.glfw.glfw;
5+
6+
7+
public class Test {
8+
9+
10+
@org.junit.jupiter.api.Test
11+
void javaGlfwWindow() {
12+
glfw glfw = uno.glfw.glfw.INSTANCE;
13+
glfw.init();
14+
GlfwWindow window = GlfwWindow.create(1280, 720, "Dear ImGui GLFW+OpenGL3 OpenGL example", MemoryUtil.NULL, null, new Vec2i(30));
15+
assert(window.getHandle() != MemoryUtil.NULL);
16+
}
17+
// GlfwWindow w1 = GlfwWindow.Companion.(1280, 720, "Dear ImGui GLFW+OpenGL3 OpenGL example", MemoryUtil.NULL, null, new Vec2i(30));
18+
}
File renamed without changes.

core/src/test/kotlin/uno/helloWorld.kt renamed to gl/src/test/kotlin/uno/helloWorld.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package uno
22

33
import io.kotest.core.spec.style.StringSpec
44
import org.lwjgl.opengl.GL11.*
5-
import uno.glfw.GlWindow
5+
import uno.gl.GlWindow
66
import uno.glfw.GlfwWindow
77
import uno.glfw.glfw
88
import uno.kotlin.isNotCI

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
3131

3232
gradle.rootProject {
3333
group = "kotlin.graphics"
34-
version = "0.7.18"
34+
version = "0.7.19"
3535
}
3636

3737
dependencyResolutionManagement {

0 commit comments

Comments
 (0)