Skip to content

Commit cabad87

Browse files
committed
infix isPressed/Release key and button
1 parent ce62b09 commit cabad87

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ext {
1717
kx = "com.github.kotlin-graphics"
1818
kotlin_version = '1.3.50'
1919
kotlintest_version = '3.4.0'
20-
vkk_version = 'b7f9ad03ab98046ee4d3684836fc9fdac73ab594'
20+
vkk_version = 'dfe678f2556b04b0a3384c62ac0614d892cc7b3d'
2121
gln_version = '7d31a75d53594f70f9111b5617c83b1b9095a01f'
2222
gli_version = '0ea3295ed86b66d548dc71ef10bbf0259f49e0a7'
2323
glm_version = 'a484ec1181813912c5a69d3a6706a994ca138eff'

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package uno.glfw
22

3-
import glm_.BYTES
43
import glm_.bool
54
import glm_.f
65
import glm_.i
@@ -420,7 +419,7 @@ open class GlfwWindow(var handle: GlfwWindowHandle) {
420419
val defaultKeyCallback: KeyCallbackT = { key, scanCode, action, mods -> onKey(Key of key, scanCode, action, mods) }
421420
val defaultMouseButtonCallback: MouseButtonCallbackT = { button, action, mods -> onMouse(MouseButton of button, action, mods) }
422421
val defaultCursorPosCallback: CursorPosCallbackT = { pos -> onMouseMoved(pos) }
423-
val defaultCursorEnterCallback: CursorEnterCallbackT = { entered -> if(entered) onMouseEntered() else onMouseExited() }
422+
val defaultCursorEnterCallback: CursorEnterCallbackT = { entered -> if (entered) onMouseEntered() else onMouseExited() }
424423
val defaultScrollCallback: ScrollCallbackT = { scroll -> onMouseScrolled(scroll.y.f) }
425424
val defaultWindowCloseCallback: WindowCloseCallbackT = ::onWindowClosed
426425
val defaultWindowContentScaleCallback: WindowContentScaleCallbackT = { newScale -> onWindowContentScaled(newScale) }
@@ -479,11 +478,11 @@ open class GlfwWindow(var handle: GlfwWindowHandle) {
479478

480479
enum class CursorStatus { Normal, Hidden, Disabled }
481480

482-
fun isPressed(key: Key) = glfwGetKey(handle.L, key.i) == GLFW_PRESS
483-
fun isReleased(key: Key) = glfwGetKey(handle.L, key.i) == GLFW_RELEASE
481+
infix fun isPressed(key: Key): Boolean = glfwGetKey(handle.L, key.i) == GLFW_PRESS
482+
infix fun isReleased(key: Key): Boolean = glfwGetKey(handle.L, key.i) == GLFW_RELEASE
484483

485-
fun isPressed(button: MouseButton) = glfwGetMouseButton(handle.L, button.i) == GLFW_PRESS
486-
fun isRelease(button: MouseButton) = glfwGetMouseButton(handle.L, button.i) == GLFW_RELEASE
484+
infix fun isPressed(button: MouseButton): Boolean = glfwGetMouseButton(handle.L, button.i) == GLFW_PRESS
485+
infix fun isRelease(button: MouseButton): Boolean = glfwGetMouseButton(handle.L, button.i) == GLFW_RELEASE
487486

488487
val joystick1Buttons: ByteBuffer?
489488
get() = getJoystickButtons(GLFW_JOYSTICK_1)

0 commit comments

Comments
 (0)