Skip to content

IWindowBridge

interface IWindowBridge
Extends: IBridge
Known subtypes: Lwjgl2WindowBridge, GlfwWindowBridge, SnapshotWindowBridge
Package: dev.joid.lib.bridge.window · Module: core · Source: IWindowBridge.java

The bridge that reads the drawable size, the mouse, the held keys and the clipboard of the window, in screen pixels.

It never creates a window: the backend or the host owns it. The input events do not go through it; the backend forwards them to BridgeHandler.UI. Window bridge shows one that reads everything from the engine that owns the window.

ReturnsSignatureSummary
intgetWidth() abstractReturns the width of the drawable surface, in screen pixels; 0 while the window is minimized.
intgetHeight() abstractReturns the height of the drawable surface, in screen pixels; 0 while the window is minimized.
doublegetMouseX() abstractReturns the horizontal position of the mouse, in screen pixels from the left edge.
doublegetMouseY() abstractReturns the vertical position of the mouse, in screen pixels from the top edge.
booleanisMouseGrabbed() abstractIf true, the host hides and locks the cursor, for a camera for example, and JOID leaves the cursor alone.
booleanisKeyDown(Key physicalKey) abstractIf true, the key at that physical position is held, whatever the keyboard layout.
StringgetClipboard() abstractReturns the text of the system clipboard, or an empty string when it holds no text; never throws.
voidsetClipboard(String text) abstractPuts the text in the system clipboard; never throws.
ReturnsSignatureSummary
voidsetCursor(Cursor cursor) hook defaultShows that system cursor over the window; does nothing by default.
voidsetTextInputArea(BoundingBox area) hook defaultReceives the area of the cursor of the focused text field, in screen pixels, or null once no field has the focus; does nothing by default.

int getWidth() abstract

Returns the width of the drawable surface, in screen pixels; 0 while the window is minimized.

int getHeight() abstract

Returns the height of the drawable surface, in screen pixels; 0 while the window is minimized.

double getMouseX() abstract

Returns the horizontal position of the mouse, in screen pixels from the left edge.

double getMouseY() abstract

Returns the vertical position of the mouse, in screen pixels from the top edge.

boolean isMouseGrabbed() abstract

If true, the host hides and locks the cursor, for a camera for example, and JOID leaves the cursor alone.

boolean isKeyDown(Key physicalKey) abstract

If true, the key at that physical position is held, whatever the keyboard layout.

String getClipboard() abstract

Returns the text of the system clipboard, or an empty string when it holds no text; never throws.

void setClipboard(String text) abstract

Puts the text in the system clipboard; never throws.

void setCursor(Cursor cursor) hook default

Shows that system cursor over the window; does nothing by default. JOID calls it once per change, never while isMouseGrabbed() returns true.

void setTextInputArea(BoundingBox area) hook default

Receives the area of the cursor of the focused text field, in screen pixels, or null once no field has the focus; does nothing by default. JOID calls it once per change: a host whose text input must be switched on, or whose input method places its window near the text, starts it on an area and stops it on null.


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