GlfwInputForwarder
final class GlfwInputForwarder
Package: dev.joid.base.lwjgl3.glfw.input · Module: base-lwjgl3-glfw · Source: GlfwInputForwarder.java
Backends: LWJGL 3 Vulkan
Forwards the input of a GLFW window to the UI bridges of JOID, ahead of the GLFW callbacks the window already had.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
void | attach(long window) static | Installs the character, cursor, cursor enter, scroll, key and mouse button callbacks of the window, and calls the callbacks that the window had before for every event that JOID does not consume. |
boolean | forwardKey(int code, int action) static | Forwards one key event of GLFW, its key code and its action, to BridgeHandler.UI: GLFW_PRESS presses the key at that position with the key that the layout prints there, GLFW_RELEASE releases it, and GLFW_REPEAT asks whether JOID consumed its press. |
boolean | forwardMouseButton(int button, int action) static | Forwards one mouse button event of GLFW, its button and its action, to BridgeHandler.UI as a press or a release. |
double[] | getEventCursor(long window) static | The position, in window coordinates, of the mouse event that a callback installed by attach forwards for this window: {x, y} of its last cursor event. |
Method details
Section titled “Method details”attach
Section titled “attach”void attach(long window) static
Installs the character, cursor, cursor enter, scroll, key and mouse button callbacks of the window, and calls the callbacks that the window had before for every event that JOID does not consume.
It keeps the position of the last cursor event, until the cursor leaves the window, and gives it to getEventCursor while it forwards a move, a button or a scroll.
When the window has a CharMods callback, JOID receives the characters through it, and the previous character callbacks only get the characters that JOID did not consume.
A key repeat never reaches JOID as a press: the previous callback receives it unless JOID consumed the press of that key.
The LWJGL 3 and Vulkan backends call it during register().
forwardKey
Section titled “forwardKey”boolean forwardKey(int code, int action) static
Forwards one key event of GLFW, its key code and its action, to BridgeHandler.UI: GLFW_PRESS presses the key at that position with the key that the layout prints there, GLFW_RELEASE releases it, and GLFW_REPEAT asks whether JOID consumed its press.
Returns true when JOID consumed the event, which the host then drops.
forwardMouseButton
Section titled “forwardMouseButton”boolean forwardMouseButton(int button, int action) static
Forwards one mouse button event of GLFW, its button and its action, to BridgeHandler.UI as a press or a release.
Returns true when JOID consumed the event, which the host then drops.
getEventCursor
Section titled “getEventCursor”double[] getEventCursor(long window) static
The position, in window coordinates, of the mouse event that a callback installed by attach forwards for this window: {x, y} of its last cursor event.
Returns null outside such a call, and before the first cursor event or after the cursor left the window; GlfwWindowBridge then asks GLFW for the cursor.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
