public void UpdateInput(ref InputFrame frame) { // [FOREACH PERFORMANCE] Should not allocate garbage foreach (var mapping in Mappings) { mapping.Execute(ref frame); } }
public void Execute(ref InputFrame frame) { bool execute = Filter?.Invoke(frame) ?? true; if (execute) { Action(frame); } }
/// <summary> /// Either of the buttons was pressed between this and last frame (and is still pressed in the current frame) /// </summary> /// <param name="buttons">The buttons</param> /// <returns>True if any of the buttons was just pressed, otherwise false</returns> public bool IsAnyJustPressed(params Buttons[] buttons) { InputFrame tmpThis = this; return(buttons.Any(b => tmpThis.IsJustPressed(b))); }
/// <summary> /// Either of the keys was pressed between this and last frame (and is still pressed in the current frame) /// </summary> /// <param name="keys">The keys</param> /// <returns>True if any of the keys was just pressed, otherwise false</returns> public bool IsAnyKeyJustPressed(params Keys[] keys) { InputFrame tmpThis = this; return(keys.Any(k => tmpThis.IsKeyJustPressed(k))); }