aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/keybindings/SavedKeyBinding.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/keybindings/SavedKeyBinding.kt')
-rw-r--r--src/main/kotlin/keybindings/SavedKeyBinding.kt8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/kotlin/keybindings/SavedKeyBinding.kt b/src/main/kotlin/keybindings/SavedKeyBinding.kt
index 5bca87e..d85c303 100644
--- a/src/main/kotlin/keybindings/SavedKeyBinding.kt
+++ b/src/main/kotlin/keybindings/SavedKeyBinding.kt
@@ -57,7 +57,9 @@ data class SavedKeyBinding(
fun isShiftDown() = InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_LEFT_SHIFT)
|| InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_RIGHT_SHIFT)
- }
+ fun unbound(): SavedKeyBinding =
+ SavedKeyBinding(GLFW.GLFW_KEY_UNKNOWN)
+ }
fun isPressed(atLeast: Boolean = false): Boolean {
if (!isBound) return false
@@ -87,6 +89,10 @@ data class SavedKeyBinding(
return keyCode == this.keyCode && getMods(modifiers) == Triple(shift, ctrl, alt)
}
+ override fun toString(): String {
+ return format().string
+ }
+
fun format(): Text {
val stroke = Text.literal("")
if (ctrl) {