Skip to content

Commit

Permalink
0.7.19
Browse files Browse the repository at this point in the history
- offered a static GlfwWindow constructor counterpart for the constructors using inline classes (for Java)
- added a test
- fixed previous tests
  • Loading branch information
elect86 committed May 17, 2023
1 parent 92c8e73 commit 5944e18
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
12 changes: 8 additions & 4 deletions core/src/main/kotlin/uno/glfw/GlfwWindow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import org.lwjgl.glfw.*
import org.lwjgl.glfw.GLFW.*
import org.lwjgl.system.MemoryStack
import org.lwjgl.system.MemoryUtil
import org.lwjgl.system.MemoryUtil.memGetAddress
import org.lwjgl.system.MemoryUtil.memUTF8
import org.lwjgl.system.MemoryUtil.*
import org.lwjgl.system.Pointer
import uno.kotlin.*
import java.util.*
import java.util.function.BooleanSupplier
import java.util.function.Consumer

open class GlfwWindow(var handle: Long) {

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

@JvmStatic
infix fun from(handle: Long): GlfwWindow = GlfwWindow(handle)
@JvmStatic @Throws(RuntimeException::class)
fun create(width: Int, height: Int,
title: String = "Glfw Window",
monitor: Long = MemoryUtil.NULL,
share: GlfwWindow? = null,
position: Vec2i? = null): GlfwWindow = GlfwWindow(glfwCreateWindow(width, height, title, monitor, share?.handle ?: NULL))
}
}
18 changes: 18 additions & 0 deletions core/src/test/java/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import glm_.vec2.Vec2i;
import org.lwjgl.system.MemoryUtil;
import uno.glfw.GlfwWindow;
import uno.glfw.glfw;


public class Test {


@org.junit.jupiter.api.Test
void javaGlfwWindow() {
glfw glfw = uno.glfw.glfw.INSTANCE;
glfw.init();
GlfwWindow window = GlfwWindow.create(1280, 720, "Dear ImGui GLFW+OpenGL3 OpenGL example", MemoryUtil.NULL, null, new Vec2i(30));
assert(window.getHandle() != MemoryUtil.NULL);
}
// GlfwWindow w1 = GlfwWindow.Companion.(1280, 720, "Dear ImGui GLFW+OpenGL3 OpenGL example", MemoryUtil.NULL, null, new Vec2i(30));
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package uno

import io.kotest.core.spec.style.StringSpec
import org.lwjgl.opengl.GL11.*
import uno.glfw.GlWindow
import uno.gl.GlWindow
import uno.glfw.GlfwWindow
import uno.glfw.glfw
import uno.kotlin.isNotCI
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

gradle.rootProject {
group = "kotlin.graphics"
version = "0.7.18"
version = "0.7.19"
}

dependencyResolutionManagement {
Expand Down

0 comments on commit 5944e18

Please sign in to comment.