DebugControlsNode class

Wires the engine's own debug controls to the keyboard for as long as this node is mounted.

The default controls are as follows:

Key Parameter Does
F1 spatial Draws every spatial node's bounds.
F2 collision Draws every collider's hitbox.
F3 input Draws every input node's hit area.
F4 layout Draws every layout node's box.
F5 pause Pauses and resumes the scene this node is in.
F6 clear Clears the overlay, whatever it was drawing.

Every parameter is a set of matchers. Pass const {} to decline a control, your own set to remap it, or omit it for the default.

The default priority is lower than usual to ensure key presses prefer actual game controls, if they overlap with the debug controls.

Inheritance
Available extensions

Constructors

DebugControlsNode({Set<ControlEvent>? spatial, Set<ControlEvent>? collision, Set<ControlEvent>? input, Set<ControlEvent>? layout, Set<ControlEvent>? pause, Set<ControlEvent>? clear, Set<String> groups = const {'debug'}, int? priority = -1000, bool? enabled})

Properties

activity ↔ Activity
What this node takes part in: ticking, rendering, and hearing input. Defaults to Activity.all.
getter/setter pairinherited
ancestors → Iterable<Node>
This node's ancestors in the tree.
no setterinherited
children → Iterable<Node>
This node's direct children.
no setterinherited
clear → Set<ControlEvent>
Clears the overlay, whatever it was drawing.
final
collision → Set<ControlEvent>
Toggles every collider's hitbox.
final
descendants → Iterable<Node>
This node's descendants in depth-first preorder.
no setterinherited
enabled ↔ bool
Whether this node ticks, renders, and hears input, all three.
getter/setter pairinherited
groups → Set<String>
The groups gating all of them, if any.
final
hashCode → int
The hash code for this object.
no setterinherited
hasParent → bool
True if this node has a non-null parent.
no setterinherited
input → Set<ControlEvent>
Toggles every input node's hit area.
final
isMounted → bool
True while this node is part of a mounted tree.
no setterinherited
isRemoving → bool
True while this node awaits removal at the next flush.
no setterinherited
layout → Set<ControlEvent>
Toggles every layout node's box.
final
onMount → Signal0
Emitted when this node is added to a scene.
finalinherited
onSceneResize → Signal1<Vector2>
Emitted when the scene resizes, and once at mount.
finalinherited
onUnmount → Signal0
Emitted when this node is removed from a scene.
finalinherited
parent → Node?
The parent that owns this node, or null when it is parentless.
no setterinherited
pause → Set<ControlEvent>
Pauses and resumes the scene this node is in.
final
priority ↔ int
This node's order in updating and rendering in its parent. Defaults to 0.
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scene → Scene<Node>
This node's owning scene. Only valid while isMounted.
no setterinherited
spatial → Set<ControlEvent>
Toggles every spatial node's bounds.
final

Methods

add<T extends Node>(T node) → T
Adds node to this node. The node is returned.
inherited
addAll(Iterable<Node> nodes) → void
Adds all nodes to this node.
inherited
attach(Node node) → void
Adds this node to the target node.
inherited
build() → void
Declares this node's children and behavior.
override
contains(Node other) → bool
Checks if this node contains the other node in its tree.
inherited
containsPoint(Vector2 point) → bool
Whether this node's hit area contains point.
inherited
cycles(Node node) → bool
True if node is (or soon will be) an ancestor of this node.
inherited
debugDraw(DebugDraw draw) → void
Draws to the debug overlay every frame, in the same space as draw.
inherited
debugRender(Canvas canvas) → void
Renders the debug overlay for this node and its children to canvas.
inherited
debugRenderSelf(Canvas canvas) → void
Runs this node's debugDraw callbacks, in the same space as renderSelf.
inherited
detach() → bool
Removes this node from its parent, or from the parent it is on its way to.
inherited
disable() → void
Disables this node, so it stops updating, rendering and answering.
inherited
draw(Draw draw) → void
Draws to canvas every frame, in this node's own coordinate space.
inherited
enable() → void
Enables this node, so it resumes updating, rendering and answering.
inherited
hitTest(Vector2 point) → Iterable<Node>
Finds every node in this subtree whose hit area contains point, per containsPoint, topmost first. A node hearing no input hides its whole subtree.
inherited
mount() → Scene<T>

Available on T, provided by the Mount extension

Mounts this node as the root of a new Scene and returns it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
owns(Node other) → bool
Checks if this node owns the other node.
inherited
provide<T>(T value) → void
Provides value as this node's instance of T, overwriting any value previously provided for T.
inherited
query<T extends Node>() → Iterable<T>
This node's direct children of type T, in priority order.
inherited
read<T>() → T
As readOrNull, but throws a StateError when nothing provided T.
inherited
readOrNull<T>() → T?
Reads the nearest instance of T provided by this node or an ancestor, checking this node first. Returns null if none was provided.
inherited
remove(Node node) → bool
Removes the child node.
inherited
removeAll() → void
Removes all children.
inherited
render(Canvas canvas) → void
Renders this node and its children to canvas.
inherited
renderChildren(Canvas canvas) → void
Renders this node's enabled children to canvas, in priority order.
inherited
renderSelf(Canvas canvas) → void
Runs this node's draw callbacks.
inherited
tick(Tick tick) → void
Calls tick with the elapsed seconds on every frame.
inherited
toString() → String
A string representation of this object.
inherited
trash(Cleanup cleanup) → void
Defers cleanup until this build stops being current.
inherited
traverse({bool prune(Node node)?}) → Iterable<Node>
This node and its subtree, in postorder: every child before its parent, and children in reverse priority order.
inherited
update(double dt) → void
Updates this node and its children by dt seconds.
inherited

Operators

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