From 4b9e966ca7e8a9291f307850f715820e122d69fd Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Tue, 17 Jun 2025 20:59:45 +0200 Subject: feat: Add macro wheels --- src/main/kotlin/keybindings/SavedKeyBinding.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/kotlin/keybindings/SavedKeyBinding.kt') diff --git a/src/main/kotlin/keybindings/SavedKeyBinding.kt b/src/main/kotlin/keybindings/SavedKeyBinding.kt index 3ae0b89..fc0270d 100644 --- a/src/main/kotlin/keybindings/SavedKeyBinding.kt +++ b/src/main/kotlin/keybindings/SavedKeyBinding.kt @@ -7,6 +7,7 @@ import net.minecraft.client.util.InputUtil import net.minecraft.text.Text import moe.nea.firmament.util.MC +// TODO: add support for mouse keybindings @Serializable data class SavedKeyBinding( val keyCode: Int, @@ -86,6 +87,12 @@ data class SavedKeyBinding( (shift == this.shift) } + override fun matchesAtLeast(keyCode: Int, scanCode: Int, modifiers: Int): Boolean { + if (this.keyCode == GLFW.GLFW_KEY_UNKNOWN) return false + val (shift, ctrl, alt) = getMods(modifiers) + return keyCode == this.keyCode && this.shift <= shift && this.ctrl <= ctrl && this.alt <= alt + } + override fun matches(keyCode: Int, scanCode: Int, modifiers: Int): Boolean { if (this.keyCode == GLFW.GLFW_KEY_UNKNOWN) return false return keyCode == this.keyCode && getMods(modifiers) == Triple(shift, ctrl, alt) -- cgit