diff options
author | nea <nea@nea.moe> | 2023-08-31 23:23:43 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-08-31 23:23:43 +0200 |
commit | 41dc53e00e683c62cec8eb08641156077b84639c (patch) | |
tree | 1d9757fde571e27430573f7b2f4a69380e0608e1 /src/main/kotlin/moe/nea/firmament/gui/config | |
parent | 36d5ef29e45a57e88d9d608d1becb5cb7de27cf5 (diff) | |
download | firmament-41dc53e00e683c62cec8eb08641156077b84639c.tar.gz firmament-41dc53e00e683c62cec8eb08641156077b84639c.tar.bz2 firmament-41dc53e00e683c62cec8eb08641156077b84639c.zip |
Add the ability to unbind keys using ESCAPE
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/gui/config')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/gui/config/KeyBindingHandler.kt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/config/KeyBindingHandler.kt b/src/main/kotlin/moe/nea/firmament/gui/config/KeyBindingHandler.kt index 11c9c7a..42cf66c 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/config/KeyBindingHandler.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/config/KeyBindingHandler.kt @@ -8,16 +8,16 @@ package moe.nea.firmament.gui.config import io.github.cottonmc.cotton.gui.widget.WButton import io.github.cottonmc.cotton.gui.widget.data.InputResult +import org.lwjgl.glfw.GLFW import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement -import moe.nea.firmament.keybindings.FirmamentKeyBindings -import moe.nea.firmament.keybindings.SavedKeyBinding import net.minecraft.client.util.InputUtil import net.minecraft.text.Text import net.minecraft.util.Formatting -import org.lwjgl.glfw.GLFW +import moe.nea.firmament.keybindings.FirmamentKeyBindings +import moe.nea.firmament.keybindings.SavedKeyBinding class KeyBindingHandler(name: String, managedConfig: ManagedConfig) : ManagedConfig.OptionHandler<SavedKeyBinding> { init { @@ -46,6 +46,7 @@ class KeyBindingHandler(name: String, managedConfig: ManagedConfig) : ManagedCon lastPressedNonModifier = 0 editing = false lastPressed = 0 + opt.value = SavedKeyBinding(GLFW.GLFW_KEY_UNKNOWN) updateButton!!() return InputResult.PROCESSED } |