Skip to content

Commit 5baf599

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 78ffe7f + fc08261 commit 5baf599

File tree

10 files changed

+190
-150
lines changed

10 files changed

+190
-150
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ext{
1616
kotlin = 'org.jetbrains.kotlin:kotlin'
1717
kotlin_version = '1.3.11'
1818
kotlintest_version = '3.1.11'
19-
gln_version = '8082ce6286faeb842813c86af4b46adc430c12dd'
19+
gln_version = '980c4b28f15aabf881b30805e454d9df31b7f20c'
2020
vkk_version = 'a0d037b48e'
2121
lwjgl_version = "3.2.1"
2222
lwjgl_natives = current() == WINDOWS ? "windows" : current() == LINUX ? "linux" : "macos"
@@ -34,8 +34,8 @@ dependencies {
3434
testImplementation "io.kotlintest:kotlintest-runner-junit5:$kotlintest_version".toString()
3535

3636
def joglVersion = '2.3.2'
37-
implementation "org.jogamp.gluegen:gluegen-rt-main:$joglVersion".toString()
38-
implementation "org.jogamp.jogl:jogl-all-main:$joglVersion".toString()
37+
testImplementation "org.jogamp.gluegen:gluegen-rt-main:$joglVersion".toString()
38+
testImplementation "org.jogamp.jogl:jogl-all-main:$joglVersion".toString()
3939

4040
["", "-glfw", "-jemalloc", "-openal", "-opengl", "-stb", "-vulkan", "-jawt"].each {
4141
implementation "org.lwjgl:lwjgl$it:$lwjgl_version"

src/main/kotlin/uno/al/openAL.kt

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -17,60 +17,6 @@ import java.nio.Buffer
1717
import java.nio.IntBuffer
1818
import java.nio.ShortBuffer
1919

20-
fun main(args: Array<String>) {
21-
22-
val device = ALCdevice.open()
23-
24-
val context = device.createContext().apply { makeCurrent() }
25-
26-
val alcCapabilities = device.createCapabilities()
27-
val alCapabilities = AL.createCapabilities(alcCapabilities)
28-
29-
val stack = stackPush()
30-
//Allocate space to store return information from the function
31-
val channelsBuffer = stack.mallocInt(1)
32-
val sampleRateBuffer = stack.mallocInt(1)
33-
34-
val (rawAudioBuffer, channels, sampleRate) = stbVorbis.decodeFilename("C:\\Users\\elect\\Downloads\\sample.ogg")
35-
36-
//Find the correct OpenAL format
37-
val format = when (channels) {
38-
1 -> al.Format.MONO16
39-
2 -> al.Format.STEREO16
40-
else -> al.Format.UNDEFINED
41-
}
42-
43-
//Request space for the buffer
44-
val buffer = al.genBuffer()
45-
46-
//Send the data to OpenAL
47-
buffer.data(format, rawAudioBuffer, sampleRate)
48-
49-
//Free the memory allocated by STB
50-
rawAudioBuffer.free()
51-
52-
//Request a source
53-
val source = al.genSource()
54-
55-
//Assign the sound we just loaded to the source
56-
source.buffer = buffer
57-
58-
//Play the sound
59-
source.play()
60-
61-
try {
62-
//Wait for a second
63-
Thread.sleep(100_000)
64-
} catch (ignored: InterruptedException) {
65-
}
66-
67-
//Terminate OpenAL
68-
source.delete()
69-
buffer.delete()
70-
context.destroy()
71-
device.close()
72-
}
73-
7420
object alc {
7521

7622
val currentContext: ALCcontext

src/main/kotlin/uno/glfw/windowHint.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ object windowHint {
4747

4848
var maximized = false
4949
set(value) {
50-
glfwWindowHint(GLFW_FLOATING, value.i)
50+
glfwWindowHint(GLFW_MAXIMIZED, value.i)
5151
field = value
5252
}
5353

@@ -255,4 +255,4 @@ object windowHint {
255255
})
256256
field = value
257257
}
258-
}
258+
}

src/main/kotlin/uno/kotlin/util.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
package uno.kotlin
22

33
import glm_.i
4-
import kool.Adr
5-
import org.lwjgl.opengl.GL
6-
import org.lwjgl.opengl.GLCapabilities
7-
import org.lwjgl.system.Pointer
84
import java.awt.event.KeyEvent
95
import java.io.File
106
import java.lang.Appendable

src/test/java/main/Prova.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package main;
22

33
import org.lwjgl.system.Platform;
4-
import uno.awt.LwjglCanvas;
4+
import uno.jawt.LwjglCanvas;
55

66
import javax.swing.*;
77
import java.awt.*;

src/test/kotlin/uno/AwtTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import glm_.f
44
import org.lwjgl.opengl.GL
55
import org.lwjgl.opengl.GL11.*
66
import uno.awt.AWTGLCanvas
7-
import uno.awt.AbstractGears
7+
import uno.jawt.AbstractGears
88
import uno.awt.GLData
99
import java.awt.BorderLayout
1010
import java.awt.Dimension

src/test/kotlin/uno/al/openAL.kt

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package uno.al
2+
3+
import kool.free
4+
import org.lwjgl.openal.AL
5+
import org.lwjgl.system.MemoryStack
6+
7+
8+
fun main(args: Array<String>) {
9+
10+
val device = ALCdevice.open()
11+
12+
val context = device.createContext().apply { makeCurrent() }
13+
14+
val alcCapabilities = device.createCapabilities()
15+
val alCapabilities = AL.createCapabilities(alcCapabilities)
16+
17+
val stack = MemoryStack.stackPush()
18+
//Allocate space to store return information from the function
19+
val channelsBuffer = stack.mallocInt(1)
20+
val sampleRateBuffer = stack.mallocInt(1)
21+
22+
val (rawAudioBuffer, channels, sampleRate) = stbVorbis.decodeFilename("C:\\Users\\elect\\Downloads\\sample.ogg")
23+
24+
//Find the correct OpenAL format
25+
val format = when (channels) {
26+
1 -> al.Format.MONO16
27+
2 -> al.Format.STEREO16
28+
else -> al.Format.UNDEFINED
29+
}
30+
31+
//Request space for the buffer
32+
val buffer = al.genBuffer()
33+
34+
//Send the data to OpenAL
35+
buffer.data(format, rawAudioBuffer, sampleRate)
36+
37+
//Free the memory allocated by STB
38+
rawAudioBuffer.free()
39+
40+
//Request a source
41+
val source = al.genSource()
42+
43+
//Assign the sound we just loaded to the source
44+
source.buffer = buffer
45+
46+
//Play the sound
47+
source.play()
48+
49+
try {
50+
//Wait for a second
51+
Thread.sleep(100_000)
52+
} catch (ignored: InterruptedException) {
53+
}
54+
55+
//Terminate OpenAL
56+
source.delete()
57+
buffer.delete()
58+
context.destroy()
59+
device.close()
60+
}

src/main/kotlin/uno/awt/AbstractGears.kt renamed to src/test/kotlin/uno/jawt/AbstractGears.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package uno.awt
1+
package uno.jawt
22

33

44
import glm_.d

src/main/kotlin/uno/awt/JawtDemo.kt renamed to src/test/kotlin/uno/jawt/JawtDemo.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
package uno.awt
1+
package uno.jawt
22

33
import gli_.has
44
import glm_.vec2.Vec2i
5-
import gln.cap.Caps
65
import org.lwjgl.glfw.GLFWErrorCallback
7-
import org.lwjgl.opengl.GLCapabilities
86
import org.lwjgl.opengl.GLUtil
97
import org.lwjgl.system.Callback
108
import org.lwjgl.system.MemoryUtil.NULL

0 commit comments

Comments
 (0)