UserInterface<T extends InputBase> class
Modal user interface that maintains a stack of UI Layers and writes them to a Terminal. The UI manages the main game loop and renders as efficiently as possible based on the state of the Layer stack.
The UI also provides for input handling, which Layers can opt into if needed.
Constructors
-
UserInterface([RenderableTerminal<
Renderer> ? _terminal])
Properties
- handlingKeyInput ← bool
-
Set to true to have the UserInterface begin handling keyboard input
events and delegating them to its layers based on the current keyBinds.
Set to false to cancel all keyboard event handling within this UI.
no getter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keyBinds
→ KeyBindings<
T> -
Keyboard input bindings that this UI consumes and handles.
final
- renderRect → Rect
-
The Rect representing the size of the underlying terminal that this UI
is rendering to.
no setter
- running ↔ bool
-
Whether the UI's game loop is running and rendering frames. Initially off.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
terminal
← RenderableTerminal<
Renderer> -
Assign a new RenderableTerminal to this UI.
no getter
Methods
-
dirty(
) → void - Require the UI to render during the next render call.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pop(
[Object? result]) → void -
Pop the top-most Layer off of the stack and activate the one below it
(if there is one), passing the optional
result
value. -
push(
Layer< T> layer) → void - Push a new Layer onto the top of the stack.
-
render(
[bool ignoreDirty = false]) → void -
Renders the current game state to the current terminal, if one is
currently bound to this UI. If manually calling render, you can request
that the UI render regardless of the current dirty state by setting
ignoreDirty
to true. -
swap(
Layer< T> layer) → void -
Swap the top-most Layer on the stack for the given
layer
. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
double ds) → void -
Update all of the Layers currently bound to the UI, regardless of
whether they're currently visible or not. The provided value,
ds
, is the elapsed time in (fractional) seconds since the last call to update. You can use this value to provide consistent animations or game flow regardless of the underlying framerate.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited