Example #1
0
 /// <summary>
 /// Creates an action from a given string identifier.
 /// Throws an exception if the given string specifies a key or gamepad control that does not exist.
 /// </summary>
 /// <param name="value">The action name.</param>
 /// <returns>A valid and functional action if the name is valid;
 /// null if neither a keyboard nor a gamepad action is specified;
 /// a non functional dummy action with correct name, if a gamepad action for a not connected gamepad is specified.</returns>
 public static IAction FromString(string value)
 {
     return(value.ToLowerInvariant().Trim() == "unbound"
         ? InputAction.Unbound
         : KeyboardAction.FromString(value) ?? GamePadAction.FromString(value));
 }
Example #2
0
 /// <summary>
 /// Returns all actions for a specified gamepad.
 /// </summary>
 /// <param name="pad">The gamepad to get actions for.</param>
 public static IEnumerable <IAction> GetAll(InputManager.GamePadStateContainer pad)
 {
     return(GamePadAction.GetAll(pad.Id));
 }