MouseBinding class final

Binds an action to the pointer's position.

cursor = input.has<MousePosition>(const MouseBinding());

Nothing to configure and nothing to name: there is one pointer, so unlike TriggerBinding this takes no InputKey. Mouse buttons are ordinary triggers (TriggerBinding(InputKey.leftMouseButton)) - only the position needs its own binding, because it is the one input that is not a bit.

isActuated is always false: a position has no pressed/released edge, so wasPressedThisFrame and the pressed/released streams never fire for an action bound to one. Bind a button if you want the click.

Inheritance

Constructors

MouseBinding()
const

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith() MouseBinding
createStorage() MousePosition
Fresh scratch for an action to own and resolve to write into.
override
isActuated(InputState state) bool
Whether this binding counts as held right now - the single bit wasPressedThisFrame, wasReleasedThisFrame, pressed and released are all derived from.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(InputState state, MousePosition storage) MousePosition
Computes this tick's value from state, writing into storage and returning it.
override
toJson() Map<String, Object?>
This binding as plain JSON-able maps, for the game's own save file. The inverse is a static fromJson on the concrete type - see the class doc.
override
toString() String
A string representation of this object.
override

Operators

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

Static Methods

fromJson(Map<String, Object?> json) MouseBinding
Round-trips, trivially - there is no state to restore. Present so a rebinding screen can serialize every binding uniformly rather than special-casing this one.