Float slider
fourlastor opened this issue · comments
Daniele Conti commented
private class FloatFieldScope constructor(name: String?, instance: Any?, field: Field) :
FieldScope(name, instance, field) {
private val value: FloatArray
init {
try {
value = FloatArray(1) { field.getFloat(instance) }
} catch (e: IllegalAccessException) {
throw RuntimeException(e)
}
}
override fun display() {
ImGui.dragFloat(name, value )
}
override fun apply() {
try {
field.setFloat(instance, value[0])
} catch (e: IllegalAccessException) {
throw RuntimeException(e)
}
}
}