public void HandleMouseButtonStateChange(InputState state, MouseButton button, ButtonStateChangeKind kind) { if (mouseButtonEventManagers.TryGetValue(button, out var manager)) { manager.HandleButtonStateChange(state, kind, Time.Current); } }
public virtual void HandleJoystickButtonStateChange(InputState state, JoystickButton button, ButtonStateChangeKind kind) { if (kind == ButtonStateChangeKind.Pressed) { handleJoystickPress(state, button); } else { handleJoystickRelease(state, button); } }
protected override void Handle(IInputStateChangeHandler handler, InputState state, MouseButton button, ButtonStateChangeKind kind) => handler.HandleMouseButtonStateChange(state, button, kind);
/// <summary> /// Handles a <see cref="TButton"/> state change. /// This can be used to invoke the <see cref="IInputStateChangeHandler"/>'s HandleXXXStateChange methods. /// </summary> /// <param name="handler">The <see cref="IInputStateChangeHandler"/> that should handle the <see cref="InputState"/> change.</param> /// <param name="state">The <see cref="InputState"/> which changed.</param> /// <param name="button">The <see cref="TButton"/> that changed.</param> /// <param name="kind">The type of change that occurred on <paramref name="button"/>.</param> protected abstract void Handle(IInputStateChangeHandler handler, InputState state, TButton button, ButtonStateChangeKind kind);
public ButtonStateChangeEvent(InputState state, IInput input, TButton button, ButtonStateChangeKind kind) : base(state, input) { Button = button; Kind = kind; }
/// <summary> /// Create a <typeparamref name="TButton"/> state change event. /// </summary> /// <param name="state">The <see cref="InputState"/> which changed.</param> /// <param name="button">The <typeparamref name="TButton"/> that changed.</param> /// <param name="kind">The type of change that occurred on <paramref name="button"/>.</param> protected virtual ButtonStateChangeEvent <TButton> CreateEvent(InputState state, TButton button, ButtonStateChangeKind kind) => new ButtonStateChangeEvent <TButton>(state, this, button, kind);
protected override void Handle(IInputStateChangeHandler handler, InputState state, Key key, ButtonStateChangeKind kind) => handler.HandleKeyboardKeyStateChange(state, key, kind);