mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 02:15:34 -04:00
rendering: fix mouse key input handling
This commit is contained in:
parent
33045040ec
commit
320abcb306
@ -24,6 +24,8 @@ import de.bixilon.minosoft.gui.rendering.RenderWindow
|
|||||||
import de.bixilon.minosoft.gui.rendering.hud.elements.input.KeyConsumer
|
import de.bixilon.minosoft.gui.rendering.hud.elements.input.KeyConsumer
|
||||||
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
|
import de.bixilon.minosoft.protocol.network.connection.PlayConnection
|
||||||
import de.bixilon.minosoft.util.logging.Log
|
import de.bixilon.minosoft.util.logging.Log
|
||||||
|
import de.bixilon.minosoft.util.logging.LogLevels
|
||||||
|
import de.bixilon.minosoft.util.logging.LogMessageType
|
||||||
import org.lwjgl.glfw.GLFW.*
|
import org.lwjgl.glfw.GLFW.*
|
||||||
|
|
||||||
class RenderWindowInputHandler(
|
class RenderWindowInputHandler(
|
||||||
@ -55,6 +57,10 @@ class RenderWindowInputHandler(
|
|||||||
|
|
||||||
var currentKeyConsumer: KeyConsumer? = null
|
var currentKeyConsumer: KeyConsumer? = null
|
||||||
|
|
||||||
|
fun mouseKeyInput(windowId: Long, button: Int, action: Int, modifierKey: Int) {
|
||||||
|
keyInput(windowId, button, 0, action, modifierKey)
|
||||||
|
}
|
||||||
|
|
||||||
fun keyInput(windowId: Long, key: Int, char: Int, action: Int, modifierKey: Int) {
|
fun keyInput(windowId: Long, key: Int, char: Int, action: Int, modifierKey: Int) {
|
||||||
if (windowId != renderWindow.windowId) {
|
if (windowId != renderWindow.windowId) {
|
||||||
return
|
return
|
||||||
@ -72,7 +78,7 @@ class RenderWindowInputHandler(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
Log.warn("Unknown glfw action $action")
|
Log.log(LogMessageType.RENDERING_GENERAL, LogLevels.WARN) { "Unknown glfw action $action" }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,6 +254,7 @@ class RenderWindow(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
glfwSetKeyCallback(this.windowId, inputHandler::keyInput)
|
glfwSetKeyCallback(this.windowId, inputHandler::keyInput)
|
||||||
|
glfwSetMouseButtonCallback(this.windowId, inputHandler::mouseKeyInput)
|
||||||
|
|
||||||
glfwSetCharCallback(windowId, inputHandler::charInput)
|
glfwSetCharCallback(windowId, inputHandler::charInput)
|
||||||
glfwSetCursorPosCallback(windowId, inputHandler::mouseMove)
|
glfwSetCursorPosCallback(windowId, inputHandler::mouseMove)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user