diff options
Diffstat (limited to 'src/main/kotlin/keybindings')
| -rw-r--r-- | src/main/kotlin/keybindings/GenericInputButton.kt | 6 | ||||
| -rw-r--r-- | src/main/kotlin/keybindings/SavedKeyBinding.kt | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main/kotlin/keybindings/GenericInputButton.kt b/src/main/kotlin/keybindings/GenericInputButton.kt index 2d81bd8..53c0e56 100644 --- a/src/main/kotlin/keybindings/GenericInputButton.kt +++ b/src/main/kotlin/keybindings/GenericInputButton.kt @@ -1,9 +1,7 @@ package moe.nea.firmament.keybindings -import com.mojang.serialization.Codec import org.lwjgl.glfw.GLFW import kotlinx.serialization.KSerializer -import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder @@ -67,6 +65,7 @@ sealed interface GenericInputButton { fun ofScanCode(scanCode: Int): GenericInputButton = ScanCodeButton(scanCode) fun ofScanCodeFromKeyCode(keyCode: Int): GenericInputButton = ScanCodeButton(GLFW.glfwGetKeyScancode(keyCode)) fun unbound(): GenericInputButton = Unbound + fun mouse(mouseButton: Int): GenericInputButton = MouseButton(mouseButton) fun ofKeyAndScan(keyCode: Int, scanCode: Int): GenericInputButton { if (keyCode == GLFW.GLFW_KEY_UNKNOWN) return ofScanCode(scanCode) @@ -198,7 +197,8 @@ data class InputModifiers( val modifiers: Int ) { companion object { - fun getCurrentModifiers(): InputModifiers { + @JvmStatic + fun current(): InputModifiers { val h = MC.window.handle val ctrl = if (MinecraftClient.IS_SYSTEM_MAC) { InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_LEFT_SUPER) diff --git a/src/main/kotlin/keybindings/SavedKeyBinding.kt b/src/main/kotlin/keybindings/SavedKeyBinding.kt index bc99e03..48716d3 100644 --- a/src/main/kotlin/keybindings/SavedKeyBinding.kt +++ b/src/main/kotlin/keybindings/SavedKeyBinding.kt @@ -9,7 +9,7 @@ data class SavedKeyBinding( val modifiers: InputModifiers, ) { companion object { - fun isShiftDown() = InputModifiers.getCurrentModifiers().shift + fun isShiftDown() = InputModifiers.current().shift fun unbound(): SavedKeyBinding = withoutMods(GenericInputButton.unbound()) fun withoutMods(input: GenericInputButton) = SavedKeyBinding(input, InputModifiers.none()) @@ -21,7 +21,7 @@ data class SavedKeyBinding( fun isPressed(atLeast: Boolean = false): Boolean { if (!button.isPressed()) return false - val mods = InputModifiers.getCurrentModifiers() + val mods = InputModifiers.current() return mods.matches(this.modifiers, atLeast) } |
