Layer<T extends InputBase> class abstract

Each Layer in the UserInterface can manage different aspects of the overall game. For instance, one layer for the game map, one layer for an information side panel, another layer for each different pop-up, etc. Layers can be opaque or transparent to control how far down the UserInterface's stack of Layers the game gets rendered.

Each Layer has its own start, update, and render methods that the bound UserInterface will call automatically. Layers can also manage their own input handling.

Implementers

Constructors

Layer()

Properties

hashCode int
The hash code for this object.
no setterinherited
isBound bool
Returns true if the layer is currently bound to a UserInterface.
no setter
isHandlingInput bool
Should return true if this layer wants to handle input when it is the active (top-most) layer. Returns false if any bound UserInterface should not pass any input to the layer.
no setter
isTransparent bool
Should true if this layer is transparent, allowing the layer below it to render. Returns false if this layer is opaque.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
ui UserInterface<T>
The UserInterface that this Layer is bound to. Throws an exception if the layer is not currently bound.
no setter

Methods

dirty() → void
Inform the bound UserInterface that this Layer needs to be rendered during the next UserInterface.render call.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onActive(Layer<T> popped, Object? result) → void
Called by the UI when the Layer above this one has been popped, making this layer the top-most in the bound UserInterface. If a result value was passed to UserInterface.pop, it is provided here as result.
onInput(T input) bool
If one is bound, the UserInterface will pass all bound input events to this Layer if it is the active (top-most) layer. If this method returns false (the default ), the respective lower-level input handler will be called.
onKeyDown(String key, String code, {required bool shift, required bool altOpt, required bool ctrl, required bool meta}) bool
If this Layer is active (top-most) and accepting inputs, any keyboard key down events not handled by the higher-level Layer.onInput handler will be passed here by the bound UserInterface.
onKeyUp(String key, String code, {required bool shift, required bool altOpt, required bool ctrl, required bool meta}) bool
If this Layer is active (top-most) and accepting inputs, all keyboard key up events will be passed here by the bound UserInterface.
onResize(Vec2 size) → void
Called whenever this Layer is bound to a new UserInterface or the Terminal assigned to the bound UI changes.
render(Terminal terminal) → void
Render the Layer using the given Terminal.
start() → void
Initialize the state if this Layer. This will be called only once, right after the layer is bound to a UserInterface.
toString() String
A string representation of this object.
inherited
update(double ds) → void
Update the state of this Layer. The provided value, ds, is the elapsed time in (fractional) seconds since the last call to update.

Operators

operator ==(Object other) bool
The equality operator.
inherited