Expand description
Actions: what a player can do, and the controls bound to each one.
A game names its own actions — Jump, Walk, Aim — in up to three
vocabularies, one per kind: a button is pressed, released or down, an
axis reads one number, an axis2 reads two. InputActions holds the
three, and Game::InputActions names the
set; NoInputActions is the set of a game that reads no input, and
Key is the prototype set that binds each key to itself. Every query
— down, pressed, released, axis, axis2 — takes an action of
that set and no other.
Each action declares its own default bindings, which may hold a key, a
mouse button, a pad button, a stick or a composite of them. An axis or
axis2 binding holds a deadzone —
AxisBinding::DEFAULT_DEADZONE
for a pad or joystick control, and zero for the rest — and a scale.
A PointerDelta lane, a WheelDelta lane and
Axis2Binding::pointer read how far
they moved through that scale and nothing clamps what they read; every
other binding reads in its kind’s own range.
A game that rebinds reads bindings for
what an action is bound to now, and shows each binding’s text.
actuated_button,
actuated_axis and
actuated_axis2 then report
whatever the player just moved, which
rebind takes. The engine keeps every
rebind in the platform’s own store, under a name made from the title
Config::new was given.
Cursor is what the pointer itself is drawn as, the closed set
set_cursor takes for one frame; a
frame that sets none draws Cursor::Arrow. Where the UI sets a cursor
of its own, the UI’s is drawn instead. Cursor::Held draws no pointer
and holds it in place, leaving a PointerDelta binding its
movement to read and pointer the place
it was held at; the frame after it sets another cursor releases it.
Structs§
- Axis2
Binding - A pair of controls that read back a vector, and the knobs they read through.
- Axis
Binding - One control that reads back a number, and the knobs it reads through.
- Button
Axis - Two buttons that make an axis:
negativecounts down,positivecounts up. - Button
Axis2 - Four buttons that make a vector, the way
WASDis laid out. - Joystick
Control - A control of a device with no standard layout, by the number its platform reports for it: captured rather than written, and usable only on the machine that captured it.
Enums§
- Button
Binding - One control that reads back
truewhile it is held. - Cursor
- What the pointer is drawn as, which
FrameContext::set_cursortakes. - Key
- A key by physical position, independent of the layout in use:
Key::Wis the key at theWposition on a US keyboard. - Mouse
Button - A mouse button. The first touch of a touch screen presses
MouseButton::Left, wherever it lands. - NoInput
Actions - The input action set of a game that reads no input at all.
- NoInput
Axes - The vocabulary of a game with no number actions of its own.
- NoInput
Axes2 - The vocabulary of a game with no vector actions of its own.
- NoInput
Buttons - The vocabulary of a game with no button actions of its own.
- Pad
- A button of the standard gamepad layout, by its position rather than by what a maker prints on it.
- PadAxis
- One lane of the standard gamepad layout: positive is right and up,
and a trigger reads
0..=1of the range. - Pointer
Delta - One lane of the pointer, reporting how far it moved since the last
frame rather than where it is, so its range is open and
AxisBinding::scaleis what bounds it. - Stick
- A stick of the standard gamepad layout, read as both its lanes at once.
- Wheel
Delta - One lane of the wheel, reporting the notches it turned since the
last frame, so its range is open and
AxisBinding::scaleis what bounds it.
Traits§
- Input
Action - Trait every action vocabulary implements, written by
InputButtonAction,InputAxisActionandInputAxis2Action. - Input
Actions - The three vocabularies one game plays with, named together as
Game::InputActions. - Input
Axis2 Action - An action that reads back a vector no longer than
1, or, bound toAxis2Binding::pointer, how far the pointer moved. - Input
Axis Action - An action that reads back a number in
-1..=1, or, bound to aPointerDeltaorWheelDeltalane, how far it moved. - Input
Button Action - An action that reads back
truewhile it is held.