aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/events')
-rw-r--r--src/main/kotlin/events/HandledScreenKeyPressedEvent.kt2
-rw-r--r--src/main/kotlin/events/WorldKeyboardEvent.kt7
2 files changed, 4 insertions, 5 deletions
diff --git a/src/main/kotlin/events/HandledScreenKeyPressedEvent.kt b/src/main/kotlin/events/HandledScreenKeyPressedEvent.kt
index de5dccf..34aebe6 100644
--- a/src/main/kotlin/events/HandledScreenKeyPressedEvent.kt
+++ b/src/main/kotlin/events/HandledScreenKeyPressedEvent.kt
@@ -1,5 +1,6 @@
package moe.nea.firmament.events
+import org.lwjgl.glfw.GLFW
import net.minecraft.client.gui.screen.ingame.HandledScreen
import moe.nea.firmament.keybindings.GenericInputAction
import moe.nea.firmament.keybindings.InputModifiers
@@ -21,6 +22,7 @@ data class HandledScreenKeyPressedEvent(
return keyBinding.matches(input, modifiers, atLeast)
}
+ fun isLeftClick() = input == GenericInputAction.mouse(GLFW.GLFW_MOUSE_BUTTON_LEFT)
companion object : FirmamentEventBus<HandledScreenKeyPressedEvent>()
}
diff --git a/src/main/kotlin/events/WorldKeyboardEvent.kt b/src/main/kotlin/events/WorldKeyboardEvent.kt
index eed892d..860db5c 100644
--- a/src/main/kotlin/events/WorldKeyboardEvent.kt
+++ b/src/main/kotlin/events/WorldKeyboardEvent.kt
@@ -4,13 +4,10 @@ import moe.nea.firmament.keybindings.GenericInputAction
import moe.nea.firmament.keybindings.InputModifiers
import moe.nea.firmament.keybindings.SavedKeyBinding
-data class WorldKeyboardEvent(val keyCode: Int, val scanCode: Int, val modifiers: Int) : FirmamentEvent.Cancellable() {
+data class WorldKeyboardEvent(val action: GenericInputAction, val modifiers: InputModifiers) : FirmamentEvent.Cancellable() {
fun matches(keyBinding: SavedKeyBinding, atLeast: Boolean = false): Boolean {
- return keyBinding.matches(intoAction(), InputModifiers(modifiers), atLeast)
+ return keyBinding.matches(action, modifiers, atLeast)
}
- fun intoAction() = GenericInputAction.key(keyCode, scanCode)
-
-
companion object : FirmamentEventBus<WorldKeyboardEvent>()
}