aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/keybindings/SavedKeyBinding.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-06-17 20:59:45 +0200
committerLinnea Gräf <nea@nea.moe>2025-06-17 21:19:43 +0200
commit4b9e966ca7e8a9291f307850f715820e122d69fd (patch)
tree94b08c865c882f93ff9c0c6aa7a507d47bcc67bf /src/main/kotlin/keybindings/SavedKeyBinding.kt
parent775933d516db10dbcc1cbbe405defa7b6e0c5a6a (diff)
downloadFirmament-4b9e966ca7e8a9291f307850f715820e122d69fd.tar.gz
Firmament-4b9e966ca7e8a9291f307850f715820e122d69fd.tar.bz2
Firmament-4b9e966ca7e8a9291f307850f715820e122d69fd.zip
feat: Add macro wheels
Diffstat (limited to 'src/main/kotlin/keybindings/SavedKeyBinding.kt')
-rw-r--r--src/main/kotlin/keybindings/SavedKeyBinding.kt7
1 files changed, 7 insertions, 0 deletions
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)