Skip to content

Commit fc3bf3f

Browse files
committed
up
1 parent 06d91ca commit fc3bf3f

30 files changed

+1523
-1194
lines changed

.github/workflows/build.yml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,66 @@ name: build
33
on: [ push ]
44

55
jobs:
6+
67
linux:
78
name: 'Linux'
89
runs-on: ubuntu-latest
910

1011
steps:
11-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1213
- uses: gradle/wrapper-validation-action@v1
13-
- name: Set up JDK 1.11
14-
uses: actions/setup-java@v1
14+
- name: Set up JDK 1.8
15+
uses: actions/setup-java@v3
1516
with:
16-
java-version: 11
17+
distribution: temurin
18+
java-version: 8
1719
- name: Grant execute permission for gradlew
1820
run: chmod +x gradlew
1921
# - name: Build with Gradle
2022
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
2123
- uses: burrunan/gradle-cache-action@v1
22-
name: Build scenery
24+
name: Build
2325
with:
24-
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
26+
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
2527
# - name: Cleanup Gradle Cache
2628
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
2729
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
2830
# run: |
2931
# rm -f ~/.gradle/caches/modules-2/modules-2.lock
3032
# rm -f ~/.gradle/caches/modules-2/gc.properties
33+
# - name: Show Working directory content
34+
# run: ls
35+
# - uses: actions/checkout@master
36+
# with:
37+
# repository: kotlin-graphics/mary
38+
# path: ./mary
39+
- name: Show ../.. directory content
40+
run: ls ../..
41+
# - name: move mary up
42+
# run: mv ./mary ../..
43+
# - name: Show Working directory content
44+
# run: ls
45+
# - name: Show ../.. directory content
46+
# run: ls ../..
3147

3248
windows:
3349
name: 'Windows'
3450
runs-on: windows-latest
3551

3652
steps:
37-
- uses: actions/checkout@v2
53+
- uses: actions/checkout@v3
3854
- uses: gradle/wrapper-validation-action@v1
39-
- name: Set up JDK 1.11
40-
uses: actions/setup-java@v1
55+
- name: Set up JDK 1.8
56+
uses: actions/setup-java@v3
4157
with:
42-
java-version: 11
58+
distribution: temurin
59+
java-version: 8
4360
# - name: Build with Gradle
4461
# run: .\gradlew.bat build -x dokkaHtml -x dokkaHtmlJar
4562
- uses: burrunan/gradle-cache-action@v1
46-
name: Build scenery
63+
name: Build
4764
with:
48-
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
65+
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
4966
# - name: Cleanup Gradle Cache
5067
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
5168
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.
@@ -58,20 +75,21 @@ jobs:
5875
runs-on: macos-latest
5976

6077
steps:
61-
- uses: actions/checkout@v2
78+
- uses: actions/checkout@v3
6279
- uses: gradle/wrapper-validation-action@v1
63-
- name: Set up JDK 1.11
64-
uses: actions/setup-java@v1
80+
- name: Set up JDK 1.8
81+
uses: actions/setup-java@v3
6582
with:
66-
java-version: 11
83+
distribution: temurin
84+
java-version: 8
6785
- name: Grant execute permission for gradlew
6886
run: chmod +x gradlew
6987
# - name: Build with Gradle
7088
# run: ./gradlew build -x dokkaHtml -x dokkaHtmlJar
7189
- uses: burrunan/gradle-cache-action@v1
72-
name: Build scenery
90+
name: Build
7391
with:
74-
arguments: build #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
92+
arguments: assemble #-x dokkaHtml -x dokkaHtmlJar -x javadoc -x dokkaJavadocJar
7593
# - name: Cleanup Gradle Cache
7694
# # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
7795
# # Restoring these files from a GitHub Actions cache might cause problems for future builds.

.idea/kotlinc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

awt/awt.gradle.kts

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import magik.createGithubPublication
22
import magik.github
3+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
35
import org.lwjgl.lwjgl
4-
import org.lwjgl.lwjgl.Module.*
6+
import org.lwjgl.Lwjgl.Module.*
57

68
plugins {
79
kotlin("jvm")
@@ -16,28 +18,19 @@ version = rootProject.version
1618
dependencies {
1719
implementation(projects.core)
1820

19-
implementation("kotlin.graphics:gln:0.5.31")
20-
implementation("kotlin.graphics:glm:0.9.9.1-5")
21-
implementation("kotlin.graphics:kool:0.9.68")
21+
api("kotlin.graphics:gln:0.5.32")
2222

2323
lwjgl { implementation(jawt, glfw, jemalloc, opengl) }
2424

25-
testImplementation("io.kotest:kotest-runner-junit5:5.4.1")
26-
testImplementation("io.kotest:kotest-assertions-core:5.4.1")
25+
testImplementation("io.kotest:kotest-runner-junit5:5.5.5")
26+
testImplementation("io.kotest:kotest-assertions-core:5.5.5")
2727
}
2828

29-
kotlin.jvmToolchain {
30-
this as JavaToolchainSpec
31-
languageVersion.set(JavaLanguageVersion.of(8))
32-
}
29+
kotlin.jvmToolchain { languageVersion.set(JavaLanguageVersion.of(8)) }
3330

3431
tasks {
35-
withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>>().all {
36-
kotlinOptions {
37-
freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")
38-
}
39-
}
40-
withType<Test>().configureEach { useJUnitPlatform() }
32+
withType<KotlinCompilationTask<*>>().configureEach { compilerOptions { freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") } }
33+
test { useJUnitPlatform() }
4134
}
4235

4336
publishing {
@@ -48,9 +41,7 @@ publishing {
4841
suppressAllPomMetadataWarnings()
4942
}
5043
}
51-
repositories {
52-
github {
53-
domain = "kotlin-graphics/mary"
54-
}
55-
}
56-
}
44+
repositories { github { domain = "kotlin-graphics/mary" } }
45+
}
46+
47+
java.withSourcesJar()

awt/src/main/kotlin/uno/awt/LwjglCanvas.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import org.lwjgl.opengl.GLUtil
66
import org.lwjgl.system.Callback
77
import org.lwjgl.system.jawt.JAWTDrawingSurface
88
import org.lwjgl.system.jawt.JAWTFunctions
9+
import uno.glfw.GlWindow
910
import uno.glfw.GlfwWindow
10-
import uno.glfw.HWND
1111
import uno.glfw.VSync
1212
import uno.glfw.glfw
13+
import uno.kotlin.HWND
1314
import java.awt.Canvas
1415
import java.awt.EventQueue
1516
import java.awt.Graphics
@@ -31,7 +32,7 @@ abstract class LwjglCanvas(val glDebug: Boolean = false) : Canvas() {
3132

3233
val awt = JAWT()
3334

34-
lateinit var glfwWindow: GlfwWindow
35+
lateinit var glWindow: GlWindow
3536

3637
var swapBuffers = true
3738
var fps = true
@@ -45,7 +46,7 @@ abstract class LwjglCanvas(val glDebug: Boolean = false) : Canvas() {
4546
init {
4647
glfw {
4748
init()
48-
windowHint { debug = glDebug }
49+
hints.context.debug = glDebug
4950
}
5051
}
5152

@@ -55,9 +56,9 @@ abstract class LwjglCanvas(val glDebug: Boolean = false) : Canvas() {
5556
initialized = true
5657

5758
// glfwWindowHint can be used here to configure the GL context
58-
glfwWindow = GlfwWindow.fromWin32Window(hwnd).apply {
59+
val glfwWindow = GlfwWindow fromWin32Window hwnd
60+
glWindow = GlWindow(glfwWindow, forwardCompatible = false).apply {
5961
makeContextCurrent()
60-
createCapabilities(forwardCompatible = false)
6162
}
6263

6364
if (glDebug)
@@ -134,12 +135,12 @@ abstract class LwjglCanvas(val glDebug: Boolean = false) : Canvas() {
134135
if (!initialized)
135136
initInternal(hwnd)
136137

137-
glfwWindow.inContext {
138+
glWindow.inContext {
138139

139140
if (resized) {
140141
// println("LwjglCanvas.reshape ${Date().toInstant()}")
141142
val newSize = Vec2i(width, height)
142-
glfwWindow.size = newSize
143+
glWindow.size = newSize
143144
reshape(newSize)
144145
resized = false
145146
// println("/LwjglCanvas.reshape ${Date().toInstant()}")
@@ -156,7 +157,7 @@ abstract class LwjglCanvas(val glDebug: Boolean = false) : Canvas() {
156157
println("paint end")
157158

158159
if (swapBuffers)
159-
glfwWindow.swapBuffers()
160+
glWindow.swapBuffers()
160161

161162
if (fps) {
162163
val now = System.currentTimeMillis()
@@ -281,15 +282,15 @@ abstract class LwjglCanvas(val glDebug: Boolean = false) : Canvas() {
281282
fun destroyInternal() {
282283
if (awtDebug) println("destroyInternal")
283284

284-
glfwWindow.inContext {
285+
glWindow.inContext {
285286
destroy()
286287
debugProc?.free()
287288
}
288289

289290
JAWTFunctions.JAWT_FreeDrawingSurface(surface, awt.FreeDrawingSurface())
290291
awt.free()
291292

292-
glfwWindow.destroy()
293+
glWindow.destroy()
293294
glfw.terminate()
294295
glfwErrorCallback.free()
295296
}

awt/src/main/kotlin/uno/awt/helpers.kt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package uno.awt
22

3+
import gln.L
34
import kool.adr
45
import org.lwjgl.system.MemoryUtil.NULL
56
import org.lwjgl.system.MemoryUtil.memGetAddress
67
import org.lwjgl.system.jawt.JAWT
7-
import org.lwjgl.system.jawt.JAWT.nGetDrawingSurface
88
import org.lwjgl.system.jawt.JAWTDrawingSurface
99
import org.lwjgl.system.jawt.JAWTDrawingSurfaceInfo
1010
import org.lwjgl.system.jawt.JAWTFunctions.*
1111
import org.lwjgl.system.jawt.JAWTWin32DrawingSurfaceInfo
12-
import uno.glfw.HWND
12+
import uno.kotlin.HWND
1313
import java.awt.Canvas
1414

1515

@@ -23,12 +23,12 @@ value class JawtVersion(val int: Int) {
2323
}
2424
}
2525

26-
fun JAWT(version: JawtVersion = JawtVersion._1_4) = org.lwjgl.system.jawt.JAWT.calloc().version(version.int)
26+
fun JAWT(version: JawtVersion = JawtVersion._1_4) = JAWT.calloc().version(version.int)
2727

28-
fun JAWT.get(): Boolean = nJAWT_GetAWT(adr)
28+
fun JAWT.get(): Boolean = nJAWT_GetAWT(adr.L)
2929

3030
fun JAWT.getDrawingSurface(canvas: Canvas): JAWTDrawingSurface? {
31-
val adr = memGetAddress(adr + org.lwjgl.system.jawt.JAWT.GETDRAWINGSURFACE)
31+
val adr = memGetAddress(adr.L + JAWT.GETDRAWINGSURFACE)
3232
val result = nJAWT_GetDrawingSurface(canvas, adr)
3333
return JAWTDrawingSurface.createSafe(result)
3434
}
@@ -46,23 +46,23 @@ value class JawtLock(val int: Int) {
4646
}
4747

4848
fun JAWTDrawingSurface.lock(): JawtLock {
49-
val funAdr = memGetAddress(adr + JAWTDrawingSurface.LOCK)
50-
return JawtLock(nJAWT_DrawingSurface_Lock(adr, funAdr))
49+
val funAdr = memGetAddress(adr.L + JAWTDrawingSurface.LOCK)
50+
return JawtLock(nJAWT_DrawingSurface_Lock(adr.L, funAdr))
5151
}
5252
fun JAWTDrawingSurface.unlock() {
53-
val funAdr = memGetAddress(adr + JAWTDrawingSurface.UNLOCK)
54-
nJAWT_DrawingSurface_Unlock(adr, funAdr)
53+
val funAdr = memGetAddress(adr.L + JAWTDrawingSurface.UNLOCK)
54+
nJAWT_DrawingSurface_Unlock(adr.L, funAdr)
5555
}
5656

5757
val JAWTDrawingSurface.info: JAWTDrawingSurfaceInfo?
5858
get() {
59-
val funAdr = memGetAddress(adr + JAWTDrawingSurface.GETDRAWINGSURFACEINFO)
60-
val result = nJAWT_DrawingSurface_GetDrawingSurfaceInfo(adr, funAdr)
59+
val funAdr = memGetAddress(adr.L + JAWTDrawingSurface.GETDRAWINGSURFACEINFO)
60+
val result = nJAWT_DrawingSurface_GetDrawingSurfaceInfo(adr.L, funAdr)
6161
return JAWTDrawingSurfaceInfo.createSafe(result)
6262
}
6363

6464
fun JAWTWin32DrawingSurfaceInfo(info: JAWTDrawingSurfaceInfo): JAWTWin32DrawingSurfaceInfo {
65-
val adr = memGetAddress(info.adr + JAWTDrawingSurfaceInfo.PLATFORMINFO)
65+
val adr = memGetAddress(info.adr.L + JAWTDrawingSurfaceInfo.PLATFORMINFO)
6666
return org.lwjgl.system.jawt.JAWTWin32DrawingSurfaceInfo.create(adr)
6767
}
6868

@@ -73,11 +73,11 @@ value class HDC(val L: Long) {
7373
}
7474

7575
val JAWTWin32DrawingSurfaceInfo.hdc: HDC
76-
get() = HDC(memGetAddress(adr + JAWTWin32DrawingSurfaceInfo.HDC))
76+
get() = HDC(memGetAddress(adr.L + JAWTWin32DrawingSurfaceInfo.HDC))
7777
val JAWTWin32DrawingSurfaceInfo.hwnd: HWND
78-
get() = HWND(memGetAddress(adr + JAWTWin32DrawingSurfaceInfo.HWND))
78+
get() = HWND(memGetAddress(adr.L + JAWTWin32DrawingSurfaceInfo.HWND))
7979

8080
infix fun JAWTDrawingSurface.free(dsi: JAWTDrawingSurfaceInfo) {
81-
val adr = memGetAddress(adr + JAWTDrawingSurface.FREEDRAWINGSURFACEINFO)
82-
nJAWT_DrawingSurface_FreeDrawingSurfaceInfo(dsi.adr, adr)
81+
val adr = memGetAddress(adr.L + JAWTDrawingSurface.FREEDRAWINGSURFACEINFO)
82+
nJAWT_DrawingSurface_FreeDrawingSurfaceInfo(dsi.adr.L, adr)
8383
}

0 commit comments

Comments
 (0)