Class InputActionRouter¶
Namespace: Apogee.Input
Assembly: Apogee.Input.dll
Turns the player's input into the actions of an
public sealed class InputActionRouter : EngineObject
Inheritance¶
object ← EngineObject ← InputActionRouter
Inherited Members¶
EngineObject.IsAdopted, EngineObject.Handle, EngineObject.IsDestroyed, EngineObject.Class, EngineObject.Adopt(), EngineObject.TryGet(SlotHandle, out EngineObject), EngineObject.Destroy(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Fields¶
DeadZone¶
Stick and trigger travel that is ignored at rest; the rest scales to 0..1.
public const float DeadZone = 0.2
Field Value¶
DoubleTapSeconds¶
How long a second tap may take.
public const double DoubleTapSeconds = 0.3
Field Value¶
HoldSeconds¶
How long a key is held before its hold binding fires.
public const double HoldSeconds = 0.4
Field Value¶
PressAt¶
An axis past this acts as a pressed button, and is released below
public const float PressAt = 0.5
Field Value¶
ReleaseAt¶
public const float ReleaseAt = 0.4
Field Value¶
Properties¶
ActionFired¶
public Signal<string> ActionFired { get; }
Property Value¶
Captured¶
The binding text of what was pressed while
public Signal<string> Captured { get; }
Property Value¶
Class¶
What the registry knows about this object's class.
public override ClassInfo Class { get; }
Property Value¶
Contexts¶
The active contexts (a situation); none ignores every input. A game sets them every frame from what the player is doing.
public string[] Contexts { get; set; }
Property Value¶
string[]
IsGamepadLast¶
True when the last input pressed was on a gamepad (the labels then name its buttons).
public bool IsGamepadLast { get; }
Property Value¶
Map¶
The actions to route. The router takes the map over: it lives as long as the router does.
public InputActionMap? Map { get; set; }
Property Value¶
Methods¶
Axis(string, float, double)¶
An axis moves: Joy LX, Joy LY, Joy RX, Joy RY (-1..1), Joy LT, Joy RT (0..1), or the mouse's motion in pixels since the last event
(Mouse X, Mouse Y), which adds up until
public void Axis(string axis, float value, double time)
Parameters¶
axis string
value float
time double
EndFrame()¶
The frame's logic has read the mouse's motion: it starts again from zero.
public void EndFrame()
GetDown()¶
The inputs that are down, sorted.
public string[] GetDown()
Returns¶
string[]
GetLabel(string)¶
What to press for an action, as the player's keyboard names it (Z on AZERTY for a W binding), or its gamepad button when the gamepad was used last;
an en dash when it is unbound.
public string GetLabel(string action)
Parameters¶
action string
Returns¶
GetStrength(string)¶
How far an action is pushed: 0 to 1 for keys, buttons, sticks and triggers (the largest of its bindings), more for the mouse's motion; 0 outside its contexts.
public float GetStrength(string action)
Parameters¶
action string
Returns¶
InContext(string)¶
public bool InContext(string action)
Parameters¶
action string
Returns¶
IsHeld(string)¶
public bool IsHeld(string action)
Parameters¶
action string
Returns¶
LabelBinding(string)¶
A binding as the player reads it: Hold Ctrl+Left mouse, Pad A, and a key by what it types on their keyboard layout.
public static string LabelBinding(string text)
Parameters¶
text string
Returns¶
Listen()¶
Rebinding: the next key (with the modifiers held), mouse button, wheel step, gamepad button or stick or trigger pushed past half way is not routed; Shift+F, Joy LY-) at the next
public void Listen()
Poll(double)¶
Fires what time has made due (a hold that has been held long enough, a tap that no second tap followed) and returns the actions fired since the last call, in order. An action bound to several inputs fires once for each.
public string[] Poll(double time)
Parameters¶
time double
Returns¶
string[]
Press(string, Modifiers, double)¶
An input goes down. modifiers are the Ctrl, Shift and Alt held with it, not counting the input itself.
public void Press(string input, Modifiers modifiers, double time)
Parameters¶
input string
modifiers Modifiers
time double
Release(string, double)¶
An input goes up.
public void Release(string input, double time)
Parameters¶
input string
time double
ReleaseAll()¶
Everything let go and forgotten: the window lost focus, or the game is changing screens.
public void ReleaseAll()
StopListening()¶
public void StopListening()
Update(double)¶
public void Update(double time)
Parameters¶
time double