20 lines
573 B
Kotlin
20 lines
573 B
Kotlin
package codes.som.hibiscus.api.feature.values
|
|
|
|
import codes.som.hibiscus.util.input.Keys
|
|
import org.lwjgl.glfw.GLFW
|
|
import java.util.*
|
|
|
|
class KeyboardValue(name: String, value: Int = GLFW.GLFW_KEY_UNKNOWN) : RegisteredValue<Int>(name, value) {
|
|
override fun convertValueFromString(representation: String): Int {
|
|
return Keys.KEY_MAP[representation.uppercase(Locale.getDefault())] ?: -1
|
|
}
|
|
|
|
override fun getValueAsString(): String {
|
|
return Keys.KEY_MAP.inverse()[value] ?: "UNKNOWN"
|
|
}
|
|
|
|
override fun drawUIControl() {
|
|
// TODO
|
|
}
|
|
}
|