This java code, is calling isKeyDown method which is in the Input kotlin class and it is throwing
Non-static method 'isKeyDown(int)' cannot be referenced from a static context
public Boolean run() {
Input.isKeyDown(GLFW.GLFW_KEY_ESCAPE);
}
}
I tried putting the kotlin method in a companion object. the only thing is the isKeyDown method loses scope of the key[ ] array which is an in the scope of the whole class
class Input{
private val keyArray :
BooleanArray =
BooleanArray(GLFW.GLFW_KEY_LAST)
/**/
companion object{
@JvmStatic
fun isKeyDown(key: Int): Boolean{
return keyArray[key] /*Unresolved reference: keyArray*/
}
}
}