Skip to content

UIBridgeRegistry

final class UIBridgeRegistry
Extends: BridgeRegistry<UIBridge>
Package: dev.joid.lib.bridge.ui · Module: core · Source: UIBridgeRegistry.java

The registry of UI bridges, which runs the frame of each one and routes the input between them.

BridgeHandler.UI is the only instance. Backend.frame calls frame(), and the input forwarders of the backends call the input methods; you call them yourself only when you forward the input of a host by hand. Each input method returns true when JOID consumed the event, which should then not reach the rest of your application.

ReturnsSignatureSummary
UIBridgeRegistry()Creates an empty registry; JOID creates the one of BridgeHandler.UI.

ReturnsSignatureSummary
booleanmouseMoved()Sends a mouse move to the bridges from the highest priority down, until one consumes it.
booleanmousePressed(MouseButton button)Sends a press to the bridges from the highest priority down, until one consumes it, and remembers the bridges that received it.
booleanmouseReleased(MouseButton button)Sends the release to every bridge that received the press of that button; returns true when one of them consumed the press.
booleanmouseScroll(double notchesX, double notchesY)Sends a scroll, in wheel notches, to the bridges from the highest priority down, until one consumes it.
booleancharTyped(int codepoint)Sends a typed Unicode code point to the bridges from the highest priority down, until one consumes it.
booleankeyPressed(Key physicalKey, Key key)Records the press in the key state, with the physical key and the key of the layout, then sends it to the bridges from the highest priority down, until one consumes it.
booleankeyReleased(Key physicalKey)Records the release in the key state and sends it to every bridge; returns true when the press of that key was consumed, so that the host hides its release too.
booleanisKeyConsumed(Key physicalKey)If true, a bridge consumed the last press of that physical key.
KeyStategetKeyState()Returns the state of the held keys, which Key.isDown reads for the keys that depend on the layout.
ReturnsSignatureSummary
IUIBridgeget(UI ui)Returns the bridge that holds the UI when it is open, otherwise the bridge of highest priority that can handle it, or null.
IUIBridgeget(Class<? extends UI> clazz)Returns the bridge of highest priority that can handle UIs of that class, or null.
ReturnsSignatureSummary
voidframe()Runs one frame: when the window size changed and is not zero, it resizes the screen and lays every UI out again; then it runs fireFrame(), updates every bridge, begins the frame of the render bridge, lets the bridge of lowest priority draw the background, draws every bridge from the lowest priority to the highest, and ends the frame.
ReturnsSignatureSummary
voidfireFrame()Runs the tasks queued by other threads on every FrameThreadBridge, then the tasks given to onFrame; frame() calls it.
Inherited from BridgeRegistry (5)

register · unregister · getBridge · find · getBridgeList

EventListenerSummary
onFrameRunnableAdds a task that runs at the start of every frame, after the tasks of other threads and before the UIs update.

UIBridgeRegistry()

Creates an empty registry; JOID creates the one of BridgeHandler.UI.

boolean mouseMoved()

Sends a mouse move to the bridges from the highest priority down, until one consumes it.

boolean mousePressed(MouseButton button)

Sends a press to the bridges from the highest priority down, until one consumes it, and remembers the bridges that received it.

boolean mouseReleased(MouseButton button)

Sends the release to every bridge that received the press of that button; returns true when one of them consumed the press.

boolean mouseScroll(double notchesX, double notchesY)

Sends a scroll, in wheel notches, to the bridges from the highest priority down, until one consumes it.

boolean charTyped(int codepoint)

Sends a typed Unicode code point to the bridges from the highest priority down, until one consumes it.

boolean keyPressed(Key physicalKey, Key key)

Records the press in the key state, with the physical key and the key of the layout, then sends it to the bridges from the highest priority down, until one consumes it. Key repeats come from JOID itself: send only the first press.

boolean keyReleased(Key physicalKey)

Records the release in the key state and sends it to every bridge; returns true when the press of that key was consumed, so that the host hides its release too.

boolean isKeyConsumed(Key physicalKey)

If true, a bridge consumed the last press of that physical key.

KeyState getKeyState()

Returns the state of the held keys, which Key.isDown reads for the keys that depend on the layout.

IUIBridge get(UI ui)

Returns the bridge that holds the UI when it is open, otherwise the bridge of highest priority that can handle it, or null.

IUIBridge get(Class<? extends UI> clazz)

Returns the bridge of highest priority that can handle UIs of that class, or null.

void frame()

Runs one frame: when the window size changed and is not zero, it resizes the screen and lays every UI out again; then it runs fireFrame(), updates every bridge, begins the frame of the render bridge, lets the bridge of lowest priority draw the background, draws every bridge from the lowest priority to the highest, and ends the frame.

void fireFrame()

Runs the tasks queued by other threads on every FrameThreadBridge, then the tasks given to onFrame; frame() calls it.

this onFrame(Runnable task) fluent

Adds a task that runs at the start of every frame, after the tasks of other threads and before the UIs update.


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

Report a problem with this page