FocusIO

FocusIO is an input handler system that reads events off devices like keyboards or gamepads, which do not map directly to screen coordinates.

Most of the time, FocusIO systems will pass the events they receive to an ActionIO system, and then send these actions to a focused node.

Multiple different FocusIO instances can coexist in the same tree, allowing for multiple different nodes to be focused at the same time, as long as they belong in different branches of the node tree. That means two different nodes can be focused by two different FocusIO systems, but a single FocusIO system can only focus a single node.

Members

Functions

emitEvent
void emitEvent(InputEvent event)

Read an input event from an input device. Input devices will call this function every frame if an input event occurs.

readText
char[] readText(char[] buffer, int offset)

Read text inserted by the user into a buffer.

typeText
void typeText(char[] text)

Write text received from the system. Input devices should call this function every frame to transmit text that the user wrote on the keyboard, which other nodes can then read through readText.

Inherited Members

From IO

opEquals
bool opEquals(Object )
Undocumented in source.
loadTo
void loadTo(T resource)

Load a resource by reference. This is the same as Node.load.

From WithFocus

currentFocus
inout(Focusable) currentFocus()

Note: Currently focused node may have blocksInput set to true; take care to check it before calling input handling methods.

currentFocus
Focusable currentFocus(Focusable newValue)

Change the currently focused node to another.

isFocusActionable
bool isFocusActionable()
isFocused
bool isFocused(Focusable focusable)
clearFocus
void clearFocus()

Clear current focus (set it to null).

Meta